#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<string> v(n);
    map<string, int> m;
    vector<int> canrev(n, 1);
    map<pair<int, int>, vector<int> > idx;
    int c1 = 0, c0 = 0;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      string second = v[i];
      int st = second[0] - '0';
      int e = second.back() - '0';
      idx[{st, e}].push_back(i);
      reverse((second).begin(), (second).end());
      if (m.count(second)) {
        canrev[i] = 0;
        canrev[m[second]] = 0;
      } else if (v[i].back() == v[i][0])
        canrev[i] = 0;
      m[v[i]] = i;
    }
    if (idx[{0, 0}].size() && idx[{1, 1}].size() && !idx[{0, 1}].size() &&
        !idx[{1, 0}].size()) {
      cout << -1 << endl;
      continue;
    }
    c0 = idx[{0, 1}].size();
    c1 = idx[{1, 0}].size();
    int amt = abs(c0 - c1) / 2;
    vector<int> ans;
    if (c0 > c1 + 1) {
      for (auto id : idx[{0, 1}]) {
        if (canrev[id]) {
          ans.push_back(id + 1);
          amt--;
        }
        if (!amt) break;
      }
    } else if (c1 > c0 + 1) {
      for (auto id : idx[{1, 0}]) {
        if (canrev[id]) {
          ans.push_back(id + 1);
          amt--;
        }
        if (!amt) break;
      }
    }
    if (amt)
      cout << -1 << endl;
    else {
      cout << ans.size() << endl;
      for (auto x : ans) cout << x << " ";
      cout << endl;
    }
  }
  return 0;
}
