#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  ;
  long long z;
  cin >> z;
  for (; z--;) {
    long long a;
    cin >> a;
    vector<string> m(a);
    int can[a];
    set<string> s;
    for (int q = 0; q < a; q++) {
      cin >> m[q];
      s.insert(m[q]);
    }
    for (int q = 0; q < a; q++) {
      reverse(m[q].begin(), m[q].end());
      can[q] = !s.count(m[q]);
      reverse(m[q].begin(), m[q].end());
    }
    long long fl = 1;
    vector<long long> n, t(4), msk(a);
    int i = 0;
    for (string &u : m) {
      int mask = (u[0] == '1') * 2 + (u.back() == '1') * 1;
      t[mask]++;
      msk[i++] = mask;
    }
    if (!(t[1] + t[2]))
      fl = t[0] == a || t[3] == a;
    else {
      long long ABS = abs(t[1] - t[2]), nd = t[2] > t[1] ? 2 : 1;
      for (int q = 0; q < a && ABS > 1; q++) {
        if (msk[q] != nd || !can[q]) continue;
        ABS -= 2;
        n.push_back(q + 1);
      }
      fl = ABS < 2;
    }
    if (!fl)
      cout << "-1\n";
    else {
      cout << n.size() << "\n";
      for (long long i : n) cout << i << " ";
      cout << "\n";
    }
  }
}
