#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b, long long mod) {
  if (b == 0) return 1 % mod;
  long long res = powmod(a, b / 2, mod);
  res = (res * res) % mod;
  if (b & 1) res = (res * a) % mod;
  return res;
}
void solve() {
  int n, m;
  cin >> n;
  vector<int> a(n + 1);
  int key = -1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      key = i;
      break;
    }
  }
  if (key == -1) {
    for (int i = 1; i <= n + 1; i++) {
      cout << i << ' ';
    }
    cout << "\n";
  } else {
    for (int i = 1; i < key; i++) {
      cout << i << ' ';
    }
    cout << n + 1 << " ";
    for (int i = key; i <= n; i++) {
      cout << i << ' ';
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
