#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long LLINF = 1e18 + 7;
set<string> s00, s01, s10, s11;
string rev(string s) {
  string t = s;
  for (int i = 0; i < s.size(); i++) {
    t[i] = s[s.size() - i - 1];
  }
  return t;
}
map<string, int> MP;
vector<int> ans;
bool ok;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  int t, n;
  string s;
  cin >> t;
  int pocz0, kon0, pocz1, kon1;
  while (t--) {
    pocz0 = kon0 = pocz1 = kon1 = 0;
    ok = true;
    ans.clear();
    MP.clear();
    cin >> n;
    s11.clear(), s10.clear(), s01.clear(), s00.clear();
    for (int i = 0; i < n; i++) {
      cin >> s;
      MP[s] = i + 1;
      if (s[0] == '1') {
        if (s[s.size() - 1] == '1') {
          s11.insert(s);
          pocz1++;
          kon1++;
        } else {
          s10.insert(s);
          pocz1++;
          kon0++;
        }
      } else {
        if (s[s.size() - 1] == '1') {
          s01.insert(s);
          pocz0++;
          kon1++;
        } else {
          s00.insert(s);
          pocz0++;
          kon0++;
        }
      }
    }
    if (s01.empty() && s10.empty() && (!s11.empty() && !s00.empty())) {
      cout << -1 << '\n';
      continue;
    }
    int siz01 = s01.size(), siz10 = s10.size();
    if (siz01 > siz10 + 1) {
      auto it = s01.begin();
      while (siz01 > siz10 + 1 && it != s01.end()) {
        string revv = rev(*it);
        auto it2 = s10.find(revv);
        if (it2 == s10.end()) {
          siz01--;
          siz10++;
          s10.insert(revv);
          ans.push_back(MP[*it]);
        }
        it++;
      }
      if (siz01 > siz10 + 1) {
        cout << -1 << '\n';
        continue;
      }
    } else if (siz10 > siz01 + 1) {
      auto it = s10.begin();
      while (siz10 > siz01 + 1 && it != s10.end()) {
        string revv = rev(*it);
        auto it2 = s01.find(revv);
        if (it2 == s01.end()) {
          siz10--;
          siz01++;
          s01.insert(revv);
          ans.push_back(MP[*it]);
        }
        it++;
      }
      if (siz10 > siz01 + 1) {
        cout << -1 << '\n';
        continue;
      }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    cout << '\n';
  }
}
