#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
using namespace this_thread;
const int mod = 1e9 + 7;
const char space = ' ';
char cc = 0;
template <class type>
void readers(type &var) {
  var = 0;
  char prev;
  while (cc < 48 || cc >= 58) {
    prev = cc;
    cc = getchar();
  }
  if (prev == 45) {
    while (cc >= 48 && cc < 58) {
      var = (var * 10) - (cc - 48);
      cc = getchar();
    }
  } else {
    while (cc >= 48 && cc < 58) {
      var = (var << 1) + (var << 3) + (cc - 48);
      cc = getchar();
    }
  }
}
void readers(string &var) {
  var = "";
  while (cc <= 32 || cc == 126) {
    cc = getchar();
  }
  while (cc > 32 && cc != 126) {
    var.push_back(cc);
    cc = getchar();
  }
}
struct reader {
  template <class type>
  reader &operator>>(type &var) {
    readers(var);
    return *this;
  }
};
signed main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  long long tc;
  cin >> tc;
  for (long long n; tc; --tc) {
    cin >> n;
    long long arr[n];
    for (auto &x : arr) cin >> x;
    if (arr[0]) {
      cout << n + 1 << ' ';
      for (long long i = 1; i <= n; ++i) cout << i << ' ';
      cout << '\n';
    } else if (!arr[n - 1]) {
      for (long long i = 0; i <= n; ++i) cout << i + 1 << ' ';
      cout << '\n';
    } else {
      long long yes = 1;
      for (long long i = 0; i < n - 1; ++i) {
        if (!arr[i] && arr[i + 1]) {
          yes = 0;
          for (long long j = 0; j <= i; ++j) cout << j + 1 << ' ';
          cout << n + 1;
          for (long long j = i + 2; j <= n; ++j) cout << ' ' << j;
          cout << '\n';
          break;
        }
      }
      if (yes) cout << -1 << '\n';
    }
  }
  return 0;
}
