#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 2e6 + 10;
string s[maxn];
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> s[i];
    set<string> seen, bad;
    int zz = 0, oo = 0, zo = 0, oz = 0;
    for (int i = 0; i < n; ++i) {
      string t = s[i];
      if (t[0] == '0' && t[t.length() - 1] == '0')
        zz++;
      else if (t[0] == '0') {
        zo++;
        string rev(t.rbegin(), t.rend());
        if (seen.count(rev)) bad.insert(t), bad.insert(rev);
        seen.insert(t);
      } else if (t[t.length() - 1] == '0') {
        oz++;
        string rev(t.rbegin(), t.rend());
        if (seen.count(rev)) bad.insert(t), bad.insert(rev);
        seen.insert(t);
      } else
        oo++;
    }
    if (zo == 0 && oz == 0) {
      if (zz == 0 || oo == 0)
        cout << 0 << '\n' << '\n';
      else
        cout << -1 << '\n';
    } else {
      int ans = abs(zo - oz) / 2;
      cout << ans << '\n';
      for (int i = 0; i < n; ++i) {
        if (ans == 0) break;
        if (zo > oz && s[i][0] == '0' && s[i].back() == '1' && !bad.count(s[i]))
          ans--, cout << i + 1 << ' ';
        if (oz > zo && s[i][0] == '1' && s[i].back() == '0' && !bad.count(s[i]))
          ans--, cout << i + 1 << ' ';
      }
      cout << '\n';
    }
  }
  return 0;
}
