#include <bits/stdc++.h>
using namespace std;
string s, ss[4000009];
int t, n, h1, h2, c[4000009], a01, a10, a00, a11, s01, s10, N, ans, v[4000009],
    J;
void hashfun(vector<long long>& prehash, vector<long long>& power, int p,
             int m) {
  power[0] = 1;
  prehash[0] = s[0] - 'a' + 1;
  for (int i = 1; i < n; i++) power[i] = (power[i - 1] * p) % m;
  for (int i = 1; i < n; i++)
    prehash[i] = ((prehash[i - 1] * p) % m + (s[i] - 'a' + 1)) % m;
}
int subhash(vector<long long>& prehash, vector<long long>& power, int l, int r,
            int p, int m) {
  int h = prehash[r];
  if (l) h = (h - (prehash[l - 1] * power[r - l + 1]) % m + m) % m;
  return h;
}
map<string, int> mp;
void read(string& s) {
  char c[4000009];
  scanf("%s", c);
  s = c;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    a01 = a10 = s10 = s01 = a00 = a11 = J = 0;
    scanf("%d", &N);
    mp.clear();
    for (int i = 0; i < N; i++) {
      read(ss[i]);
      mp[ss[i]] = 1;
    }
    for (int i = 0; i < N; i++) {
      c[i] = 0;
      s = ss[i], n = s.size();
      if (s[0] != s[n - 1]) {
        if (s[0] == '0')
          a01++;
        else
          a10++;
        reverse(s.begin(), s.end());
        if (!mp[s]) {
          c[i] = 1;
          if (s[0] == '0')
            s10++;
          else
            s01++;
        }
      } else if (s[0] == '0')
        a00++;
      else
        a11++;
    }
    if (a00 + a11 == N) {
      if (a00 && a11)
        printf("-1\n");
      else
        cout << "0\n\n";
    } else if (abs(a01 - a10) <= 1)
      printf("0\n\n");
    else if ((a01 > a10 && (a01 - s01 - (a10 + s01)) > 1) ||
             (a10 > a01 && (a10 - s10 - (a01 + s10)) > 1))
      printf("-1\n");
    else {
      if (a01 > a10) {
        for (int i = 0; i < N && abs(a01 - a10) > 1; i++) {
          if (ss[i][0] == '0' && c[i]) {
            v[J++] = i + 1;
            a01--;
            a10++;
          }
        }
        printf("%d\n", J);
        for (int i = 0; i < J; i++) {
          printf("%d ", v[i]);
        }
        printf("\n");
      } else {
        for (int i = 0; i < N && abs(a10 - a01) > 1; i++) {
          if (ss[i][0] == '1' && c[i]) {
            v[J++] = i + 1;
            a10--;
            a01++;
          }
        }
        printf("%d\n", J);
        for (int i = 0; i < J; i++) {
          printf("%d ", v[i]);
        }
        printf("\n");
      }
    }
  }
}
