#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    if (a[n - 1] == 0)
      for (int i = 0; i <= n; ++i) cout << i + 1 << ' ';
    else {
      bool f = false;
      int idx = -1;
      for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 0 && a[i + 1] == 1) {
          f = true, idx = i;
          break;
        }
      }
      if (f) {
        for (int i = 0; i <= idx; ++i) cout << i + 1 << ' ';
        cout << n + 1 << ' ';
        for (int i = idx + 1; i < n; ++i) cout << i + 1 << ' ';
      } else {
        if (a[0] == 1) {
          cout << n + 1 << ' ';
          for (int i = 1; i <= n; ++i) cout << i << ' ';
        } else
          cout << -1;
      }
    }
    cout << endl;
  }
}
