{"trustable":false,"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":"摩卡生活的城市叫枝江市。这个城市有$n+1$个村庄和$2n-1$条定向公路。\n\n道路有两种:\n\n$n-1$道路是从$i$村到$i+1$村,为所有$1\\leq i \\leq n-1$。\n$n$条道路可用序列$a_1,\\ldots,a_n$描述。如果$a_i\u003d0$,则这些道路中的$i$条从村庄$i$到村庄$n+1$,否则从村庄$n+1$到村庄$i$,对于所有$1\\leq i\\leq n$。\n\n摩卡计划这个周末和多喜一起去远足。为了避免旅途枯燥乏味,他们计划每个村子都走一遍。他们可以从任何村庄出发,也可以在任何村庄结束。你能帮他们制定一个计划吗?"}},{"title":"Input","value":{"format":"HTML","content":"每个测试都包含多个测试用例。\n\n第一行包含一个整数 $t$ ($1 \\le t \\le 20$)--测试用例数。每个测试用例由两行组成。\n\n每个测试用例的第一行包含一个整数$n$($1 \\le n \\le 10^4$)--表示村庄数为$n+1$。\n\n每个测试用例的第二行包含 $n$个整数 $a_1, a_2, \\ldots, a_n$($0 \\le a_i \\le 1$)。若$a_i\u003d0$,表示从村庄$i$到村庄$n+1$有一条路。如果$a_i\u003d1$,则表示从村庄$n+1$到村庄$i$有一条路。\n\n保证所有测试用例的 $n$之和不超过 $10^4$。"}},{"title":"Output","value":{"format":"HTML","content":"\n对于每个测试用例,打印一行,其中包含 $n+1$个整数,其中第 $i$个数字是它们要经过的第$i$个村庄。如果答案不存在,则打印 $-1$。\n\n如果有多个正确答案,可以打印任意一个。"}},{"title":"Sample 1","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\u003e在第一个测试案例中,城市的情况如下图所示:\u003c/p\u003e\n\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/add1e5a1dbb01fe6f1f7d129386bef11?v\u003d1690566966\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\n\u003cp\u003e因此所有可能的答案都是$$$(1 \\to 4 \\to 2 \\to 3)$$$, $$$(1 \\to 2 \\to 3 \\to 4)$$$.\u003c/p\u003e\n\u003cp\u003e在第二个测试案例中,城市看起来像下图:\u003c/p\u003e\n\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/08da2b8833de0604360e0a862373db3e?v\u003d1690566966\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\n\u003cp\u003e因此所有可能的答案都是 $$$(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"}}]}