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.*;
  import java.util.*;
  import java.math.BigDecimal;
  import java.math.*;
  
  public class Main{
  	public static void main(String[] args) {
  	    
  	      TaskA solver = new TaskA();
  	      
  		     
  	      int t = in.nextInt();
  	      for (int i = 1; i <= t ; i++) {
  	          solver.solve(i, in, out);
  	      }
  	     
  	      
  //	      solver.solve(1, in, out);
  	      
  	      
  	      out.flush();
  	    out.close();
  	  }
  	
  	 static class TaskA {
  	      public void solve(int testNumber, InputReader in, PrintWriter out) {
  	    	  int n=in.nextInt();
  	    	  int []inp=new int[n];
  	    	  int go=-1;
  	    	  int come=-1;
  	    	  boolean ones=true;
  	    	  boolean zeros=true;
  	    	  for(int i=0;i<n;i++) {
  	    		  inp[i]=in.nextInt();
  	    		  if(inp[i]==0) {
  	    			  ones=false;
  	    		  }
  	    		  if(inp[i]!=0) {
  	    			  zeros=false;
  	    		  }
  	    	  }
  	    	  for(int i=0;i<n;i++) {
  	    		  if(inp[i]==0  &&inp[(i+1)%n]!=0) {
  	    			  go=i;
  	    			  come=(i+1)%n;
  	    			  break;
  	    		  }
  	    	  }
  	    	  if(zeros) {
  	    		 for(int i=1;i<=n+1;i++) {
  	    			 out.print(i+" ");
  	    		 }
  	    		 out.print("\n");
  	    		 return;
  	    	  }
  	    	  if(ones) {
  	    		  go=n-1;
  	    	  }
  	    	  if(go==-1) {
  	    		  out.println(-1);
  	    	  }
  	    	  else if(go==n-1) {
  	    		  print((n+1)+" ");
  	    		  for(int i=1;i<=n;i++) {
  	    			  out.print(i+" ");
  	    		  }
  	    		  out.print("\n");
  	    	  }
  	    	  else {
  	    		  for(int i=0;i<n;i++) {
  	    			  if(i==go) {out.print((i+1)+" "+(n+1)+" ");}
  	    			  else {out.print((i+1)+" ");}
  	    		  }
  	    		  out.print("\n");
  	    	  }
  	      }
  	  }
  	 static char comp(char x) {
  		 if(x=='R') {return 'B';}
  		 return'R';
  	 }
  	 
  	 
  
  	 
  
  	 
  	 static long power(long a,long b,long m ) {
  		 long ans=1;
  		 while(b>0) {
  			 if(b%2==1) {
  				 ans=((ans%m)*(a%m))%m; b--;
  			 }
  			 else {
  				 a=(a*a)%m;b/=2;
  			 }
  			 
  		 }
  		 return ans%m;
  	 }
  	 
  	 public static boolean repeatedSubString(String string) {
  		    return ((string + string).indexOf(string, 1) != string.length());
  		}
  	 static int search(char[]c,int start,int end,char x) {
  		 for(int i=start;i<end;i++) {
  			 if(c[i]==x) {return i;}
  		 }
  		 return -2;
  	 }
  	 static int bs(int size,int[]arr) {
  		 int x = -1;
      	 for (int b = size/2; b >= 1; b /= 2) {
          	 while (!ok(arr));
          	 }
      	 int k = x+1;
      	 return k;
  	 }
  	 
  	 static boolean ok(int[]x) {
  		 return false;
  	 }
  	 
  	 static int gcd(int a, int b) {
  	        while (b != 0) {
  	            int t = b;
  	            b = a % b;
  	            a = t;
  	        }
  	        return a;
  	    }
  	
  	 
  	 static long fun(long[]a,int f,int b,int k) {
  		 long max= Long.MIN_VALUE;
  		 while(f<b) {
   	  		max= Math.max(max, (f)*(b)-k*(a[f]|a[b]));
   	  		max= Math.max(max, (f+1)*(b)-k*(a[f+1]|a[b]));
   	  		max=Math.max(max, (f)*(b)-k*(a[f]|a[b]));
   	  	}
   	  	return max;
  	 }
  	 
  	 
  	
  	 
  	 static long fac(long a)
  	 {
  	     if(a== 0L || a==1L)return 1L ;
  	     
  	     return a*fac(a-1L) ;
  	 }
  	 static int nD(long n) {
  		 int count =0;
  		 while(n>0) {
  			 n/=10;
  			 count++;
  			 
  		 }
  		 return count;
  	 }
  	 
  	 static ArrayList al() {
  		 ArrayList<Integer>a =new ArrayList<>();
  			return a;
  		}
  	 
  	static HashSet h() {
  			return new HashSet<Integer>();
  		}
  	static void debug(int[][]a) {
  		int n= a.length;
  		for(int i=1;i<=n;i++) {
  	  		for(int j=1;j<=n;j++) {
  	  			out.print(a[i][j]+" ");
  	  		}
  	  		out.print("\n");
  	  	}
  	}
  	static void debug(int[]a) {
  			out.println(Arrays.toString(a));
  		}
  	
  	static void debug(ArrayList<Integer>a) {
  				out.println(a.toString());
  		}
  	
  	static boolean[]seive(int n){
  		boolean[]b=new boolean[n+1];
  		 for (int i = 2; i <= n; i++)
  	            b[i] = true;
  		 
  		for(int i=2;i*i<=n;i++) {
  			if(b[i]) {
  				for(int j=i*i;j<=n;j+=i) {
  					b[j]=false;
  				}
  			}
  		}
  		return b;
  	}
  	
  	 static int longestIncreasingSubseq(int[]arr) {
  		  int[]sizes=new int[arr.length];
  		  Arrays.fill(sizes, 1);
  		  int max=1;
  		  for(int i=1;i<arr.length;i++) {
  			  for(int j=0;j<i;j++) {
  				  if(arr[j]<arr[i]) {
  					  sizes[i]=Math.max(sizes[i],sizes[j]+1);
  					  max=Math.max(max, sizes[i]);
  				  }
  			  }
  		  }
  		  return max;
  	 }
  	 
  	 public static ArrayList primeFactors(long n)
  	    {
  		    ArrayList<Long>h= new ArrayList<>();
  	        // Print the number of 2s that divide n
  	        if(n%2 ==0) {h.add(2L);}
  	 
  	        // n must be odd at this point.  So we can
  	        // skip one element (Note i = i +2)
  	        for (long i = 3; i <= Math.sqrt(n); i+= 2)
  	        {
  	            if(n%i==0) {h.add(i);}
  	        }
  	        if (n > 2)
  	            h.add(n);
  	        return h;
  	    }
  	 
  	 static boolean Divisors(long n){
  		 if(n%2==1) {
  			 return true;
  		 }
  	     for (long i=2; i<=Math.sqrt(n); i++){
  	            if (n%i==0 && i%2==1){
  	                   return true;
  	            } 
  	        }
  	     return false;
  	    }
  	
  	static InputStream inputStream = System.in;
      static OutputStream outputStream = System.out;
      static InputReader in = new InputReader(inputStream);
      static PrintWriter out = new PrintWriter(outputStream);
      
      public static void superSet(int[]a,ArrayList<String>al,int i,String s) {
      	if(i==a.length) {
      		al.add(s);
      		return;
      	}
      	superSet(a,al,i+1,s);
      	superSet(a,al,i+1,s+a[i]+" ");
      }
      
  	public static long[] makeArr() {
  		long size=in.nextInt();
  		long []arr=new long[(int)size];
  		for(int i=0;i<size;i++) {
  			arr[i]=in.nextInt();
  		}
  		return arr;
  	}
  	
  	public static long[] arr(int n) {
  		long []arr=new long[n+1];
  		for(int i=1;i<n+1;i++) {
  			arr[i]=in.nextLong();
  		}
  		return arr;
  	}
    
    public static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;
  
            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);
  
            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
  
    static void print(int c) {
  		 out.print(c);
  	 }
  	 static void println(int x) {
  		 out.println(x);
  	 }
  	 static void print(String s) {
  		 out.print(s);
  	 }
  	 static void println(String s) {
  		 out.println(s);
  	 }
  public static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;
  
        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];
  
        //Copy data to temp arrays
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
  
  
        /* Merge the temp arrays */
  
        // Initial indexes of first and second subarrays
        int i = 0, j = 0;
  
        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
  
        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
  
        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
  
  public static void reverse(int[] array)
  {
      int n = array.length;
      for (int i = 0; i < n / 2; i++) {
          int temp = array[i];
          array[i] = array[n - i - 1];
          array[n - i - 1] = temp;
      }
  }
  
    public static long nCr(int n,int k)
    {
        long ans=1L;
        k=k>n-k?n-k:k;
       
        for( int j=1;j<=k;j++,n--)
        {
            if(n%j==0)
            {
                ans*=n/j;
            }else
            if(ans%j==0)
            {
                ans=ans/j*n;
            }else
            {
                ans=(ans*n)/j;
            }
        }
        return ans;
    }
    static int searchMax(int index,long[]inp) {
  	  while(index+1<inp.length &&inp[index+1]>inp[index]) {
  		  index+=1;
  	  }
  	  return index;
    }
    static int searchMin(int index,long[]inp) {
  	  while(index+1<inp.length &&inp[index+1]<inp[index]) {
  		  index+=1;
  	  }
  	  return index;
    }
  
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
  
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
  
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
  
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
      	  return Long.parseLong(next());
        }
    }
  }