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.util.concurrent.TimeUnit;
  
  public class c1559 implements Runnable{
  	
      public static void main(String[] args) {
      	try{
              new Thread(null, new c1559(), "process", 1<<26).start();
          }
          catch(Exception e){
              System.out.println(e);
          }
      }
  	public void run() {
  		FastReader scan = new FastReader();
          PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
  		//PrintWriter out = new PrintWriter("file.out");
  		Task solver = new Task();
  		int t = scan.nextInt();
  		//int t = 1;
  		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
  		out.close();
  	}
  
  	static class Task {
  		static final int oo = Integer.MAX_VALUE;
  		static final long OO = Long.MAX_VALUE;
  
  		public void solve(int testNumber, FastReader sc, PrintWriter out) {
  			int N = sc.nextInt();
  			int[] arr = sc.readArray(N);
  			List<Integer> lis = new ArrayList<>();
  			for(int i = 1; i <= N; i++) {
  				lis.add(i);
  			}
  			
  			for(int i = 0; i < N-1; i++) {
  				if(arr[i] == 0 && arr[i+1] == 1) {
  					lis.add(i+1, N+1);
  					for(int each: lis) {
  						out.print(each + " ");
  					}
  					out.println();
  					return;
  				}
  			}
  			
  			if(arr[0] == 1) {
  				lis.add(0, N+1);
  				for(int each: lis) {
  					out.print(each + " ");
  				}
  				out.println();
  				return;
  			}
  			
  			if(arr[N-1] == 0) {
  				lis.add(N+1);
  				for(int each: lis) {
  					out.print(each + " ");
  				}
  				out.println();
  				return;
  			}
  			
  			out.println(-1);
  			
  		}
  	}
  	
  	static long modDivide(long a, long b, long MOD) {
  		a %= MOD;
  		return (binpow(b, MOD-2, MOD) * a) % MOD;
  	}
  	static long binpow(long a, long b, long m) {
  		a %= m;
  		long res = 1;
  		while (b > 0) {
  			if ((b & 1) == 1)
  				res = res * a % m;
  			a = a * a % m;
  			b >>= 1;
  		}
  		return res;
  	}
  	static int[] reverse(int a[]) 
      { 
          int[] b = new int[a.length]; 
          for (int i = 0, j = a.length; i < a.length; i++, j--) { 
              b[j - 1] = a[i]; 
          } 
          
          return b;
      }
  	static long[] reverse(long a[]) 
      { 
          long[] b = new long[a.length]; 
          for (int i = 0, j = a.length; i < a.length; i++, j--) { 
              b[j - 1] = a[i]; 
          } 
          
          return b;
      }
  	static void sort(int[] x){
  		shuffle(x);
  		Arrays.sort(x);
  	}
  	static void sort(long[] x){
  		shuffle(x);
  		Arrays.sort(x);
  	}
  	static class tup implements Comparable<tup>, Comparator<tup>{
  		int a, b;
  		tup(int a,int b){
  			this.a=a;
  			this.b=b;
  		}
  		public tup() {
  		}
  		@Override
  		public int compareTo(tup o){
  			return Integer.compare(b,o.b);
  		}
  		@Override
  		public int compare(tup o1, tup o2) {
  			return Integer.compare(o1.b, o2.b);
  		}
  		
  		@Override
  	    public int hashCode() {
  			return Objects.hash(a, b);
  	    }
   
  	    @Override
  	    public boolean equals(Object obj) {
  	    	if (this == obj)
                  return true;
  	    	if (obj == null)
                  return false;
  	    	if (getClass() != obj.getClass())
                  return false;
  	    	tup other = (tup) obj;
  	    	return a==other.a && b==other.b;
  	    }
  	    
  	    @Override
  	    public String toString() {
  	    	return a + " " + b;
  	    }
  	}
  	
  	static void shuffle(int[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			int temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  	}
  
  	static void shuffle(long[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			long temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  	}
  
  	static class FastReader {
  		BufferedReader br;
  		StringTokenizer st;
  
  		public FastReader() {
  			br = new BufferedReader(new InputStreamReader(System.in));
  		}
  
  		public FastReader(String s) throws FileNotFoundException {
  			br = new BufferedReader(new FileReader(new File(s)));
  		}
  
  		String next() {
  			while (st == null || !st.hasMoreElements()) {
  				try {
  					st = new StringTokenizer(br.readLine());
  				} catch (IOException e) {
  					e.printStackTrace();
  				}
  			}
  			return st.nextToken();
  		}
  
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  
  		String nextLine() {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			return str;
  		}
  		
  		int[] readArray(int size) {
  			int[] a = new int[size];
  			for(int i = 0; i < size; i++) {
  				a[i] = nextInt();
  			}
  			return a;
  		}
  		
  		long[] readLongArray(int size) {
  			long[] a = new long[size];
  			for(int i = 0; i < size; i++) {
  				a[i] = nextLong();
  			}
  			return a;
  		}
  	}
  	
  	static void dbg(int[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  	static void dbg(long[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  	static void dbg(boolean[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  
  	static void dbg(Object... args) {
          for (Object arg : args)
              System.out.print(arg + " ");
          System.out.println();
      }
  }