#include <bits/stdc++.h>
using namespace std;
void reverseStr(string& str) {
  int n = str.length();
  for (int i = 0; i < n / 2; i++) swap(str[i], str[n - i - 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<string> a[4];
    map<string, int> mymap;
    for (int i = 0; i < n; i++) {
      string b;
      cin >> b;
      mymap[b] = i + 1;
      if (b[0] == '0' && b[b.size() - 1] == '0') {
        a[0].push_back(b);
      }
      if (b[0] == '0' && b[b.size() - 1] == '1') {
        a[1].push_back(b);
      }
      if (b[0] == '1' && b[b.size() - 1] == '0') {
        a[2].push_back(b);
      }
      if (b[0] == '1' && b[b.size() - 1] == '1') {
        a[3].push_back(b);
      }
    }
    int aa = a[0].size(), bb = a[1].size(), cc = a[2].size(), dd = a[3].size();
    if (bb == 0 && cc == 0 && aa != 0 && dd != 0) {
      cout << -1 << endl;
      continue;
    }
    int to = (bb + cc) / 2;
    bb = bb - to;
    cc = cc - to;
    if (bb >= 0 && cc >= 0) {
      cout << 0 << endl << endl;
      continue;
    }
    if (cc < 0) {
      if (bb >= abs(cc)) {
        int temp = abs(cc);
        vector<int> ans;
        for (int i = 0; i < a[1].size(); i++) {
          string tem = a[1][i];
          reverseStr(tem);
          if (mymap[tem] == 0) {
            mymap[tem]++;
            reverseStr(tem);
            ans.push_back(mymap[tem]);
            mymap[tem]--;
          }
        }
        if (ans.size() >= abs(cc)) {
          cout << abs(cc) << endl;
          for (int i = 0; i < abs(cc); i++) cout << ans[i] << " ";
          cout << endl;
        } else {
          cout << -1 << endl;
        }
      } else {
        cout << -1 << endl;
      }
    }
    if (bb < 0) {
      if (cc >= abs(bb)) {
        int temp = abs(bb);
        vector<int> ans;
        for (int i = 0; i < a[2].size(); i++) {
          string tem = a[2][i];
          reverseStr(tem);
          if (mymap[tem] == 0) {
            mymap[tem]++;
            reverseStr(tem);
            ans.push_back(mymap[tem]);
            mymap[tem]--;
          }
        }
        if (ans.size() >= abs(bb)) {
          cout << abs(bb) << endl;
          for (int i = 0; i < abs(bb); i++) cout << ans[i] << " ";
          cout << endl;
        } else {
          cout << -1 << endl;
        }
      } else {
        cout << -1 << endl;
      }
    }
  }
  return 0;
}
