#include <bits/stdc++.h>
using namespace std;
int movei[] = {0, 0, 1, -1, 1, 1, -1, -1};
int movej[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int N = 1e5 + 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<string> v(n);
    set<string> with, bad;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      with.insert(v[i]);
    }
    int zz = 0, oo = 0, oz = 0, zo = 0;
    for (int i = 0; i < n; i++) {
      string curr = v[i];
      if (curr[0] == '0' && curr.back() == '0') zz++;
      if (curr[0] == '1' && curr.back() == '1') oo++;
      if (curr[0] == '0' && curr.back() == '1') {
        zo++;
        string rev(curr.rbegin(), curr.rend());
        if (with.count(rev)) bad.insert(curr);
      }
      if (curr[0] == '1' && curr.back() == '0') {
        oz++;
        string rev(curr.rbegin(), curr.rend());
        if (with.count(rev)) bad.insert(curr);
      }
    }
    if (zo == 0 && oz == 0 && zz && oo) {
      cout << -1 << '\n';
      continue;
    }
    int ans = abs(oz - zo) / 2;
    cout << ans << '\n';
    for (int i = 0; i < n; i++) {
      if (ans == 0) break;
      string s = v[i];
      if (zo > oz && s[0] == '0' && s.back() == '1' && !bad.count(s)) {
        ans--;
        cout << i + 1 << ' ';
      }
      if (oz > zo && s[0] == '1' && s.back() == '0' && !bad.count(s)) {
        ans--;
        cout << i + 1 << ' ';
      }
    }
    cout << '\n';
  }
}
