{"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\u003eThe city where Mocha lives in is called Zhijiang. There are $$$n+1$$$ villages and $$$2n-1$$$ directed roads in this city. \u003c/p\u003e\u003cp\u003eThere are two kinds of roads:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$n-1$$$ roads are from village $$$i$$$ to village $$$i+1$$$, for all $$$1\\leq i \\leq n-1$$$. \u003c/li\u003e\u003cli\u003e $$$n$$$ roads can be described by a sequence $$$a_1,\\ldots,a_n$$$. If $$$a_i\u003d0$$$, the $$$i$$$-th of these roads goes from village $$$i$$$ to village $$$n+1$$$, otherwise it goes from village $$$n+1$$$ to village $$$i$$$, for all $$$1\\leq i\\leq n$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eMocha plans to go hiking with Taki this weekend. To avoid the trip being boring, they plan to go through every village \u003cspan class\u003d\"tex-font-style-bf\"\u003eexactly once\u003c/span\u003e. They can start and finish at any villages. Can you help them to draw up a plan? \u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eEach test contains multiple test cases. \u003c/p\u003e\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 20$$$) — the number of test cases. Each test case consists of two lines.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^4$$$) — indicates that the number of villages is $$$n+1$$$.\u003c/p\u003e\u003cp\u003eThe second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$0 \\le a_i \\le 1$$$). If $$$a_i\u003d0$$$, it means that there is a road from village $$$i$$$ to village $$$n+1$$$. If $$$a_i\u003d1$$$, it means that there is a road from village $$$n+1$$$ to village $$$i$$$.\u003c/p\u003e\u003cp\u003eIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a line with $$$n+1$$$ integers, where the $$$i$$$-th number is the $$$i$$$-th village they will go through. If the answer doesn\u0027t exist, print $$$-1$$$.\u003c/p\u003e\u003cp\u003eIf there are multiple correct answers, you can print any one of them.\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\u003e2\n3\n0 1 0\n3\n1 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 4 2 3 \n4 1 2 3 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case, the city looks like the following graph:\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/add1e5a1dbb01fe6f1f7d129386bef11?v\u003d1715747805\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003eSo all possible answers are $$$(1 \\to 4 \\to 2 \\to 3)$$$, $$$(1 \\to 2 \\to 3 \\to 4)$$$.\u003c/p\u003e\u003cp\u003eIn the second test case, the city looks like the following graph:\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/08da2b8833de0604360e0a862373db3e?v\u003d1715747805\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003eSo all possible answers are $$$(4 \\to 1 \\to 2 \\to 3)$$$, $$$(1 \\to 2 \\to 3 \\to 4)$$$, $$$(3 \\to 4 \\to 1 \\to 2)$$$, $$$(2 \\to 3 \\to 4 \\to 1)$$$.\u003c/p\u003e"}}]}