#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, N, y;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    string S;
    map<string, int> M01;
    map<string, int> M10;
    int c3 = 0, c1 = 0, c2 = 0, c4 = 0;
    for (int i = 0; i < N; i++) {
      cin >> S;
      if (S[0] == S.back() && S[0] == '0') {
        c3++;
      } else if (S[0] == S.back() && S[0] == '1') {
        c4++;
      } else if (S[0] == '0') {
        M01[S] = i + 1;
        c1++;
      } else {
        M10[S] = i + 1;
        c2++;
      }
    }
    if (c1 == 0 && c2 == 0) {
      if (c3 > 0 && c4 > 0) {
        cout << "-1\n";
      } else {
        cout << "0\n\n";
      }
    } else {
      if (c1 >= c2) {
        int count = (c1 - c2) / 2;
        vector<int> ans;
        for (auto x : M01) {
          string y = x.first;
          reverse(y.begin(), y.end());
          if (M10.find(y) == M10.end()) {
            ans.push_back(x.second);
          }
          if (ans.size() >= count) {
            break;
          }
        }
        if (ans.size() >= count) {
          cout << count << "\n";
          for (int i = 0; i < count; i++) {
            cout << ans[i] << " ";
          }
          cout << "\n";
        } else {
          cout << "-1\n";
        }
      } else {
        int count = (c2 - c1) / 2;
        vector<int> ans;
        for (auto x : M10) {
          string y = x.first;
          reverse(y.begin(), y.end());
          if (M01.find(y) == M01.end()) {
            ans.push_back(x.second);
          }
          if (ans.size() >= count) {
            break;
          }
        }
        if (ans.size() >= count) {
          cout << count << "\n";
          for (int i = 0; i < count; i++) {
            cout << ans[i] << " ";
          }
          cout << "\n";
        } else {
          cout << "-1\n";
        }
      }
    }
  }
  return 0;
}
