description: The city where Mocha lives in is called Zhijiang. There are n+1 villages and 2n-1 directed roads in this city. 
  
  There are two kinds of roads:
  
    * n-1 roads are from village i to village i+1, for all 1≤ i ≤ n-1. 
    * n roads can be described by a sequence a_1,…,a_n. If a_i=0, 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≤ i≤ n. 
  
  
  
  Mocha plans to go hiking with Taki this weekend. To avoid the trip being boring, they plan to go through every village exactly once. They can start and finish at any villages. Can you help them to draw up a plan? 
  
  Input
  
  Each test contains multiple test cases. 
  
  The first line contains a single integer t (1 ≤ t ≤ 20) — the number of test cases. Each test case consists of two lines.
  
  The first line of each test case contains a single integer n (1 ≤ n ≤ 10^4) — indicates that the number of villages is n+1.
  
  The second line of each test case contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ 1). If a_i=0, it means that there is a road from village i to village n+1. If a_i=1, it means that there is a road from village n+1 to village i.
  
  It is guaranteed that the sum of n over all test cases does not exceed 10^4.
  
  Output
  
  For 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't exist, print -1.
  
  If there are multiple correct answers, you can print any one of them.
  
  Example
  
  Input
  
  
  2
  3
  0 1 0
  3
  1 1 0
  
  
  Output
  
  
  1 4 2 3 
  4 1 2 3 
  
  Note
  
  In the first test case, the city looks like the following graph:
  
  <image>
  
  So all possible answers are (1 → 4 → 2 → 3), (1 → 2 → 3 → 4).
  
  In the second test case, the city looks like the following graph:
  
  <image>
  
  So all possible answers are (4 → 1 → 2 → 3), (1 → 2 → 3 → 4), (3 → 4 → 1 → 2), (2 → 3 → 4 → 1).
solution: import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;
  import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;
  import java.security.AccessControlException;import java.util.Arrays;import java.util.List;
  import java.util.stream.Collectors;import java.util.stream.IntStream;public class _p001559C {
  static public void main(final String[] args) throws IOException{p001559C._main(args);}
  
  static class p001559C extends Solver{public p001559C(){}@Override public void solve()throws 
  IOException{int n=sc.nextInt();sc.nextLine();int[]a=Arrays.stream(sc.nextLine().trim().split("\\s+")).filter($s2
  ->!$s2.isEmpty()).mapToInt(Integer::parseInt).toArray();if(a[n-1]==0){pw.println(IntStream.rangeClosed(1,
  n+1).mapToObj(v->Integer.toString(v)).collect(Collectors.joining(" ")));}else if(a[0]
  ==1){pw.println((n+1)+" "+IntStream.rangeClosed(1,n).mapToObj(v->Integer.toString(v)).collect(Collectors.joining(" ")));
  }else{for(int i=0;i<n-1;i++){if(a[i]==0 && a[i+1]==1){pw.print(IntStream.rangeClosed(1,
  i+1).mapToObj(v->Integer.toString(v)).collect(Collectors.joining(" ",""," ")));pw.print((n
  +1)+" ");pw.println(IntStream.rangeClosed(i+2,n).mapToObj(v->Integer.toString(v)).collect(Collectors.joining(" ")));
  return;}}pw.println(-1);}}static public void _main(String[]args)throws IOException
  {new p001559C().run();}}static class MyScanner{private StringBuilder cache=new StringBuilder();
  int cache_pos=0;private int first_linebreak=-1;private int second_linebreak=-1;private 
  StringBuilder sb=new StringBuilder();private InputStream is=null;public MyScanner(final 
  InputStream is){this.is=is;}public String charToString(final int c){return String.format("'%s'",
  c=='\n'?"\\n":(c=='\r'?"\\r":String.valueOf((char)c)));}public int get(){int res
  =-1;if(cache_pos<cache.length()){res=cache.charAt(cache_pos);cache_pos++;if(cache_pos
  ==cache.length()){cache.delete(0,cache_pos);cache_pos=0;}}else{try{res=is.read();
  }catch(IOException ex){throw new RuntimeException(ex);}}return res;}private void 
  unget(final int c){if(cache_pos==0){cache.insert(0,(char)c);}else{cache_pos--;}}
  public String nextLine(){sb.delete(0,sb.length());int c;boolean done=false;boolean 
  end=false;while((c=get())!=-1){if(check_linebreak(c)){done=true;if(c==first_linebreak)
  {if(!end){end=true;}else{cache.append((char)c);break;}}else if(second_linebreak!=
  -1 && c==second_linebreak){break;}}if(end && c!=first_linebreak && c!=second_linebreak)
  {cache.append((char)c);break;}if(!done){sb.append((char)c);}}return!done && sb.length()
  ==0?null:sb.toString();}private boolean check_linebreak(int c){if(c=='\n'|| c=='\r')
  {if(first_linebreak==-1){first_linebreak=c;}else if(c!=first_linebreak && second_linebreak
  ==-1){second_linebreak=c;}return true;}return false;}public int nextInt(){return 
  Integer.parseInt(next());}public long nextLong(){return Long.parseLong(next());}
  public boolean hasNext(){boolean res=false;int c;while((c=get())!=-1){if(!check_linebreak(c)
  && c!=' '&& c!='\t'){res=true;unget(c);break;}}return res;}public String next(){
  sb.delete(0,sb.length());boolean started=false;int c;while((c=get())!=-1){if(check_linebreak(c)
  || c==' '|| c=='\t'){if(started){unget(c);break;}}else{started=true;sb.append((char)c);
  }}return sb.toString();}public int nextChar(){return get();}public boolean eof()
  {int c=get();boolean res=false;if(c!=-1){unget(c);}else{res=true;}return res;}public 
  double nextDouble(){return Double.parseDouble(next());}}static abstract class Solver
  {protected String nameIn=null;protected String nameOut=null;protected boolean singleTest
  =false;protected MyScanner sc=null;protected PrintWriter pw=null;private int current_test
  =0;private int count_tests=0;protected int currentTest(){return current_test;}protected 
  int countTests(){return count_tests;}private void process()throws IOException{if(!singleTest)
  {count_tests=sc.nextInt();sc.nextLine();for(current_test=1;current_test<=count_tests;
  current_test++){solve();pw.flush();}}else{count_tests=1;current_test=1;solve();}
  }abstract protected void solve()throws IOException;public void run()throws IOException
  {boolean done=false;try{if(nameIn!=null){if(new File(nameIn).exists()){try(FileInputStream 
  fis=new FileInputStream(nameIn);PrintWriter pw0=select_output();){select_output();
  done=true;sc=new MyScanner(fis);pw=pw0;process();}}else{throw new RuntimeException("File "
  +new File(nameIn).getAbsolutePath()+" does not exist!");}}}catch(IOException | AccessControlException 
  ex){}if(!done){try(PrintWriter pw0=select_output();){sc=new MyScanner(System.in);
  pw=pw0;process();}}}private PrintWriter select_output()throws FileNotFoundException
  {if(nameOut!=null){return new PrintWriter(nameOut);}return new PrintWriter(System.out);
  }}static abstract class Tester{static public int getRandomInt(final int min,final 
  int max){return(min+(int)Math.floor(Math.random()*(max-min+1)));}static public long 
  getRandomLong(final long min,final long max){return(min+(long)Math.floor(Math.random()
  *(max-min+1)));}static public double getRandomDouble(final double min,final double 
  maxExclusive){return(min+Math.random()*(maxExclusive-min));}abstract protected void 
  testOutput(final List<String>output_data);abstract protected void generateInput();
  abstract protected String inputDataToString();private boolean break_tester=false;
  protected void beforeTesting(){}protected void breakTester(){break_tester=true;}
  public boolean broken(){return break_tester;}}}
  