#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int N = 4e6 + 10;
const unsigned long long p = 131;
string s;
map<string, int> mp;
void solve() {
  mp.clear();
  int n;
  cin >> n;
  set<int> l, r;
  bool f1 = false;
  bool f2 = false;
  bool f3 = false;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    if (s[0] == '0' && s.back() == '1') {
      f3 = true;
      mp[s] = i;
      reverse(s.begin(), s.end());
      if (mp.count(s)) {
        r.erase(mp[s]);
      } else
        l.insert(i);
    } else if (s[0] == '1' && s.back() == '0') {
      f3 = true;
      mp[s] = i;
      reverse(s.begin(), s.end());
      if (mp.count(s)) {
        l.erase(mp[s]);
      } else
        r.insert(i);
    } else if (s[0] == '0' && s.back() == '0')
      f1 = true;
    else
      f2 = true;
  }
  if (f1 && f2 && !f3) {
    cout << -1 << endl;
    return;
  }
  int a = l.size();
  int b = r.size();
  vector<int> res;
  if (b > a) {
    int cnt = b - a;
    cnt = cnt / 2;
    for (auto it = r.begin(); cnt--; it++) {
      res.push_back(*it);
    }
  }
  if (a > b) {
    int cnt = a - b;
    cnt = cnt / 2;
    for (auto it = l.begin(); cnt--; it++) {
      res.push_back(*it);
    }
  }
  cout << res.size() << endl;
  for (auto x : res) cout << x << " ";
  cout << endl;
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
