#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
void update(string &st, int &oo, int &zo, int &oz, int &zz) {
  char first = st[0];
  char last = st.back();
  if (first == '1' && last == '1') oo++;
  if (first == '1' && last == '0') oz++;
  if (first == '0' && last == '0') zz++;
  if (first == '0' && last == '1') zo++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (int ab = 0; ab < (t); ++ab) {
    int n;
    cin >> n;
    vector<string> arr(n);
    set<string> strs;
    int oo = 0, zo = 0, oz = 0, zz = 0;
    for (int i = 0; i < (n); ++i) {
      cin >> arr[i];
      strs.insert(arr[i]);
      update(arr[i], oo, zo, oz, zz);
    }
    if ((oo > 0 && zz > 0) && (oz == 0 && zo == 0)) {
      cout << -1 << endl;
      continue;
    }
    vector<int> res;
    for (int i = 0; i < (n); ++i) {
      if (abs(oz - zo) <= 1) break;
      char first = arr[i][0];
      char last = arr[i].back();
      reverse(arr[i].begin(), arr[i].end());
      if (oz - zo > 0 && first == '1' && last == '0') {
        if (strs.find(arr[i]) == strs.end()) {
          oz--;
          zo++;
          res.push_back(i);
        }
      }
      if (zo - oz > 0 && first == '0' && last == '1') {
        if (strs.find(arr[i]) == strs.end()) {
          zo--;
          oz++;
          res.push_back(i);
        }
      }
    }
    cout << (int)res.size() << endl;
    for (int i = 0; i < ((int)res.size()); ++i) cout << res[i] + 1 << " ";
    cout << endl;
  }
  return 0;
}
