#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, x, t;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<string> v(n);
    map<string, long long> mp;
    for (i = 0; i < n; i++) {
      cin >> v[i];
      mp[v[i]]++;
    }
    long long oz, zo, o, z;
    o = z = zo = oz = 0;
    bool ok = 1;
    for (i = 0; i < n; i++) {
      if (v[i].front() == '0' && v[i].back() == '0') z++;
      if (v[i].front() == '1' && v[i].back() == '1') o++;
      if (mp[v[i]] > 2) {
        ok = 0;
        break;
      } else if (mp[v[i]] == 2) {
        if (v[i].front() == v[i].back()) {
          ok = 0;
          break;
        }
        mp[v[i]]--;
        reverse(v[i].begin(), v[i].end());
        mp[v[i]]++;
        if (mp[v[i]] > 1) {
          ok = 0;
          break;
        }
      }
    }
    if (!ok) {
      cout << "-1\n";
      continue;
    }
    vector<long long> czo, coz;
    string temp;
    for (i = 0; i < n; i++) {
      if (v[i].front() == '0' && v[i].back() == '1') {
        zo++;
        temp = v[i];
        reverse(temp.begin(), temp.end());
        if (mp[temp] == 0) czo.push_back(i);
      } else if (v[i].front() == '1' && v[i].back() == '0') {
        oz++;
        temp = v[i];
        reverse(temp.begin(), temp.end());
        if (mp[temp] == 0) coz.push_back(i);
      }
    }
    if (zo == 0 && oz == 0) {
      if (o > 0 && z > 0)
        cout << "-1\n";
      else
        cout << "0\n";
      continue;
    }
    x = abs(zo - oz);
    if (x < 2) {
      cout << "0\n";
      continue;
    }
    vector<long long> ans;
    if (zo > oz) {
      x = x / 2;
      if (czo.size() < x)
        ok = 0;
      else {
        for (i = 0; i < x; i++) ans.push_back(czo[i]);
      }
    } else {
      x = x / 2;
      if (coz.size() < x)
        ok = 0;
      else {
        for (i = 0; i < x; i++) ans.push_back(coz[i]);
      }
    }
    if (!ok) {
      cout << "-1\n";
      continue;
    }
    cout << ans.size() << "\n";
    for (auto p : ans) cout << p + 1 << " ";
    cout << "\n";
  }
}
