#include <bits/stdc++.h>
using namespace std;
int T, n, a[400006];
int main() {
  int t1, t2, t3, ans;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
    }
    if (a[n] == 0) {
      for (int i = 1; i <= n + 1; ++i) {
        printf("%d%c", i, " \n"[i == n + 1]);
      }
      continue;
    }
    if (a[1] == 1) {
      printf("%d ", n + 1);
      for (int i = 1; i <= n; ++i) {
        printf("%d%c", i, " \n"[i == n]);
      }
      continue;
    }
    int fla = 0;
    for (int i = 1; i < n; ++i) {
      if (a[i] == 0 && a[i + 1] == 1) {
        for (int j = 1; j <= i; ++j) {
          printf("%d ", j);
        }
        printf("%d ", n + 1);
        for (int j = i + 1; j <= n; ++j) {
          printf("%d%c", j, " \n"[j == n]);
        }
        fla = 1;
        break;
      }
    }
    if (fla) continue;
    printf("-1\n");
  }
}
