#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    vector<int> start_0;
    vector<int> start_1;
    vector<int> end_0;
    vector<int> end_1;
    string* str = new string[n];
    set<string> set_str;
    for (int j = 0; j < n; j++) {
      string s;
      cin >> s;
      if (s[0] == '0') {
        start_0.push_back(j);
      } else {
        start_1.push_back(j);
      }
      if (s[s.size() - 1] == '0') {
        end_0.push_back(j);
      } else {
        end_1.push_back(j);
      }
      str[j] = s;
      set_str.insert(s);
    }
    set<int> can_reverse_start_0;
    set<int> can_reverse_start_1;
    bool flag = false;
    for (int j = 0; j < n; j++) {
      string reverse;
      if (str[j][0] != str[j][str[j].size() - 1]) {
        flag = true;
        for (int k = str[j].size() - 1; k >= 0; k--) {
          reverse += str[j][k];
        }
        if (set_str.find(reverse) == set_str.end()) {
          if (str[j][0] == '0') {
            can_reverse_start_0.insert(j);
          } else {
            can_reverse_start_1.insert(j);
          }
        }
      }
    }
    if (start_1.size() + end_1.size() > 1 &&
        start_0.size() + end_0.size() > 1 && flag == false) {
      cout << -1 << endl;
    } else {
      int a = start_1.size() - end_1.size();
      int b = start_0.size() - end_0.size();
      int c = a - can_reverse_start_1.size() * 2;
      int d = a + can_reverse_start_0.size() * 2;
      if (abs(a) <= 1 && abs(b) <= 1) {
        cout << 0 << endl << endl;
      } else if (a > 1 && c > 1) {
        cout << -1 << endl;
      } else if ((a < -1) && d < -1) {
        cout << -1 << endl;
      } else if (a > 1) {
        int answer = a / 2;
        cout << answer << endl;
        auto it = can_reverse_start_1.begin();
        for (int j = 0; j < answer; j++) {
          it++;
          cout << *it + 1 << " ";
        }
        cout << endl;
      } else {
        int answer = (-a) / 2;
        cout << answer << endl;
        auto it = can_reverse_start_0.begin();
        for (int j = 0; j < answer; j++) {
          cout << ((*it) + 1) << " ";
          it++;
        }
        cout << endl;
      }
    }
  }
}
