#include <bits/stdc++.h>
using namespace std;
struct re {
  int x, y;
};
const int inf = 1e9 + 10;
const int N = 2e5 + 10;
int n, T, num00, num11;
string a[N];
unordered_set<string> v10, v01;
string rev(string s) {
  string ans = "";
  for (int i = s.size() - 1; i >= 0; --i) ans += s[i];
  return ans;
}
void solve() {
  num00 = num11 = 0;
  v01.clear();
  v10.clear();
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i][0] == '0') {
      if (a[i][(int)a[i].size() - 1] == '0')
        ++num00;
      else
        v01.insert(a[i]);
    } else {
      if (a[i][(int)a[i].size() - 1] == '1')
        ++num11;
      else
        v10.insert(a[i]);
    }
  }
  vector<string> del;
  int pre01 = v01.size(), pre10 = v10.size();
  for (auto i : v01) {
    string s = rev(i);
    if (v10.size() && v10.find(s) != v10.end()) {
      v10.erase(s);
      del.push_back(i);
    }
  }
  for (auto i : del) v01.erase(i);
  if (v01.size() == 0 && v10.size() == 0) {
    if (num00 && num11 && pre01 == 0 && pre10 == 0)
      cout << -1;
    else
      cout << 0;
    return;
  }
  if (v01.size() > v10.size()) {
    int sl = (v01.size() - v10.size()) / 2;
    cout << sl << '\n';
    for (int i = 1; i <= n; ++i) {
      if (sl == 0) break;
      if (v01.find(a[i]) != v01.end()) {
        cout << i << ' ';
        --sl;
      }
    }
  } else {
    int sl = (v10.size() - v01.size()) / 2;
    cout << sl << '\n';
    for (int i = 1; i <= n; ++i) {
      if (sl == 0) break;
      if (v10.find(a[i]) != v10.end()) {
        cout << i << ' ';
        --sl;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> T;
  while (T--) {
    solve();
    cout << "\n";
  }
  return 0;
}
