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.*;
  
  public class C {
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new
                      InputStreamReader(System.in));
          }
  
          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;
          }
      }
  
      static FastReader s = new FastReader();
      static PrintWriter out = new PrintWriter(System.out);
  
      private static int[] rai(int n) {
          int[] arr = new int[n];
          for (int i = 0; i < n; i++) {
              arr[i] = s.nextInt();
          }
          return arr;
      }
  
      private static int[][] rai(int n, int m) {
          int[][] arr = new int[n][m];
          for (int i = 0; i < n; i++) {
              for (int j = 0; j < m; j++) {
                  arr[i][j] = s.nextInt();
              }
          }
          return arr;
      }
  
      private static long[] ral(int n) {
          long[] arr = new long[n];
          for (int i = 0; i < n; i++) {
              arr[i] = s.nextLong();
          }
          return arr;
      }
  
      private static long[][] ral(int n, int m) {
          long[][] arr = new long[n][m];
          for (int i = 0; i < n; i++) {
              for (int j = 0; j < m; j++) {
                  arr[i][j] = s.nextLong();
              }
          }
          return arr;
      }
  
      private static int ri() {
          return s.nextInt();
      }
  
      private static long rl() {
          return s.nextLong();
      }
  
      private static String rs() {
          return s.next();
      }
  
      static long gcd(long a,long b)
      {
          if(b==0)
          {
              return a;
          }
          return gcd(b,a%b);
      }
  
      static int gcd(int a,int b)
      {
          if(b==0)
          {
              return a;
          }
          return gcd(b,a%b);
      }
  
      static boolean isPrime(int n) {
          //check if n is a multiple of 2
          if (n % 2 == 0) return false;
          //if not, then just check the odds
          for (int i = 3; i <= Math.sqrt(n); i += 2) {
              if (n % i == 0)
                  return false;
          }
          return true;
      }
  
      static long mpow(long base,long pow)
      {
          long res=1;
          while(pow>0)
          {
              if(pow%2==1)
              {
                  res=(res*base)%MOD;
              }
              pow>>=1;
              base=(base*base)%MOD;
          }
          return res;
      }
  
      static TreeSet<Long> set= new TreeSet<>();
      static void sieveOfEratosthenes(int n)
      {
          // Create a boolean array
          // "prime[0..n]" and
          // initialize all entries
          // it as true. A value in
          // prime[i] will finally be
          // false if i is Not a
          // prime, else true.
          boolean[] prime = new boolean[n + 1];
          for (int i = 0; i <= n; i++)
              prime[i] = true;
  
          for (int p = 2; p * p <= n; p++)
          {
              // If prime[p] is not changed, then it is a
              // prime
              if (prime[p])
              {
                  // Update all multiples of p
                  for (int i = p * p; i <= n; i += p)
                      prime[i] = false;
              }
          }
  
          // Print all prime numbers
          for (int i = 2; i <= n; i++)
          {
              if (prime[i])
              {
                  for(int pow = 1;pow<=10;pow++) {
                      long val = (long) Math.pow((long)i, pow);
                      set.add(val);
                      if(val>1000)
                      {
                          break;
                      }
                  }
              }
          }
      }
  
      static long smallestDivisor(long n)
      {
          // if divisible by 2
          if (n % 2 == 0)
              return 2;
  
          // iterate from 3 to sqrt(n)
          for (long i = 3; i * i <= n; i += 2) {
              if (n % i == 0)
                  return i;
          }
  
          return n;
      }
  
  
      static long power(long x, long y, int p)
      {
  
          // Initialize result
          long res = 1;
  
          // Update x if it is more than or
          // equal to p
          x = x % p;
  
          while (y > 0) {
  
              // If y is odd, multiply x
              // with result
              if (y % 2 == 1)
                  res = (res * x) % p;
  
              // y must be even now
              y = y >> 1; // y = y/2
              x = (x * x) % p;
          }
  
          return res;
      }
  
      // Returns n^(-1) mod p
      static long modInverse(long n, int p)
      {
          return power(n, p - 2, p);
      }
  
      // Returns nCr % p using Fermat's
      // little theorem.
      static long nCrModPFermat(int n, int r)
      {
  
          if (n<r)
              return 0;
          // Base case
          if (r == 0)
              return 1;
  
          // Fill factorial array so that we
          // can find all factorial of r, n
          // and n-r
  
  
          return (fac[n] * modInverse(fac[r], MOD)
                  % MOD * modInverse(fac[n - r], MOD)
                  % MOD)
                  % MOD;
      }
      static int MOD = (int)(1e9+7);
      static long[] fac;
      static void populateFact(int n)
      {
          fac = new long[n + 1];
          fac[0] = 1;
  
          for (int i = 1; i <= n; i++)
              fac[i] = fac[i - 1] * i % MOD;
      }
  
      static long calculate(int[] arr, int n, int k, int i)
      {
          if(i==n)
          {
              long xor = arr[0], and=arr[0];
              for(int x=1;x<n;x++)
              {
                  xor^=arr[x];
                  and&=arr[x];
              }
              if(and>=xor)
              {
                  return 1;
              }
              return 0;
          }
          long count = 0;
          for(int j=0;j<(1<<k);j++)
          {
              arr[i]=j;
              count+=calculate(arr,n,k,i+1);
          }
          return count;
      }
      static long calc(int n, int k)
      {
          int[] arr = new int[n];
          return calculate(arr,n,k,0);
      }
  
      public static void main(String[] args) {
          StringBuilder ans = new StringBuilder();
  //        MOD=13;
  //        populateFact(10);
  //
  //        System.out.println(Arrays.toString(fac));
  //        System.out.println(nCrModPFermat(10,2));
          int t = ri();
  //        int t = 1;
          while (t-- > 0)
          {
              int n=ri();
              int[] arr=rai(n);
  
              int ind = -1;
              for(int i=0;i<n;i++)
              {
                  if(arr[i]==1)
                  {
                      ind= i+1;
                      break;
                  }
              }
              if(ind==-1)
              {
                  for(int i=1;i<=n+1;i++)
                  {
                      ans.append(i).append(" ");
                  }
                  ans.append("\n");
              }
              else {
                  for(int i=1;i<ind;i++)
                  {
                      ans.append(i).append(" ");
                  }
                  ans.append(n+1).append(" ");
                  for(int i=ind;i<=n;i++)
                  {
                      ans.append(i).append(" ");
                  }
                  ans.append("\n");
              }
          }
          out.print(ans.toString());
          out.flush();
      }
  
  }
  /*
  4 3
  2 1
  1 3
  3 4
  8
  3
  1 2 3
  2 3 1
  3
  3
  2 1 2
  2 1 3
  3
   */