{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eWe say that a sequence of $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ is a palindrome if for all $$$1 \\leq i \\leq n$$$, $$$a_i \u003d a_{n-i+1}$$$. You are given a sequence of $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ and you have to find, if it exists, a \u003cspan class\u003d\"tex-font-style-it\"\u003ecycle permutation\u003c/span\u003e $$$\\sigma$$$ so that the sequence $$$a_{\\sigma(1)}, a_{\\sigma(2)}, \\ldots, a_{\\sigma(n)}$$$ is a palindrome. \u003c/p\u003e\u003cp\u003eA permutation of $$$1, 2, \\ldots, n$$$ is a bijective function from $$$\\{1, 2, \\ldots, n\\}$$$ to $$$\\{1, 2, \\ldots, n\\}$$$. We say that a permutation $$$\\sigma$$$ is a cycle permutation if $$$1, \\sigma(1), \\sigma^2(1), \\ldots, \\sigma^{n-1}(1)$$$ are pairwise different numbers. Here $$$\\sigma^m(1)$$$ denotes $$$\\underbrace{\\sigma(\\sigma(\\ldots \\sigma}_{m \\text{ times}}(1) \\ldots))$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 3 \\cdot 10^4$$$) — the number of test cases. Description of the test cases follows.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains an integer $$$n$$$ ($$$2 \\leq n \\leq 2 \\cdot 10^5$$$) — the size of the sequence.\u003c/p\u003e\u003cp\u003eThe second line of each test case contains $$$n$$$ integers $$$a_1, \\ldots, a_n$$$ ($$$1 \\leq a_i \\leq n$$$).\u003c/p\u003e\u003cp\u003eThe sum of $$$n$$$ for all test cases is at most $$$2 \\cdot 10^5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output one line with \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e if a cycle permutation exists, otherwise output one line with \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eIf the answer is \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e, output one additional line with $$$n$$$ integers $$$\\sigma(1), \\sigma(2), \\ldots, \\sigma(n)$$$, the permutation. If there is more than one permutation, you may print any.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n4\n1 2 2 1\n3\n1 2 1\n7\n1 3 3 3 1 2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n3 1 4 2 \nNO\nYES\n5 3 7 2 6 4 1 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}