#include <bits/stdc++.h>
using namespace std;
vector<string> v;
vector<long long> ans, bad;
unordered_map<string, long long> used;
string tmp;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q, n, a, b, c, d, x;
  cin >> q;
  long long aaa = 0;
  while (q--) {
    aaa++;
    cin >> n;
    v.resize(n), ans.clear(), bad.assign(n, 0), used.clear();
    a = b = c = d = x = 0;
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
      used[v[i]] = 1;
      a += (v[i].front() == '0' && v[i].back() == '0');
      b += (v[i].front() == '0' && v[i].back() == '1');
      c += (v[i].front() == '1' && v[i].back() == '0');
      d += (v[i].front() == '1' && v[i].back() == '1');
    }
    for (long long i = 0; i < n; i++) {
      tmp = v[i];
      reverse(tmp.begin(), tmp.end());
      bad[i] = used[tmp];
    }
    if (!b && !c && a && d) {
      cout << "-1\n";
      continue;
    } else {
      x = ((b + c) / 2) - min(b, c);
      for (long long i = 0; i < n; i++) {
        if (!x) {
          break;
        }
        if (bad[i]) {
          continue;
        }
        if (b == min(b, c) && (v[i].front() == '1' && v[i].back() == '0')) {
          ans.push_back(i);
          x--;
        }
        if (c == min(b, c) && (v[i].front() == '0' && v[i].back() == '1')) {
          ans.push_back(i);
          x--;
        }
      }
      if (x) {
        cout << "-1\n";
        continue;
      }
    }
    cout << (long long)(ans).size() << "\n";
    for (auto it : ans) {
      cout << it + 1 << " ";
    }
    cout << "\n";
  }
  return 0;
}
