#include <bits/stdc++.h>
using namespace std;
template <class T>
void rd(T &k) {
  char c = getchar();
  int f = 1;
  k = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f *= -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    k = k * 10 + c - '0';
    c = getchar();
  }
  k *= f;
}
const int N = 200005;
int n, m, k, s, t, num1, num2, tot, s1, s2, k1, k2, f[N];
struct node {
  int k1, k2, id;
} a[N];
map<int, int> ma;
char c[4000005];
int main() {
  int T;
  rd(T);
  while (T--) {
    rd(n);
    ma.clear();
    tot = num1 = num2 = 0;
    for (register int i = 1; i <= n; ++i) {
      scanf("%s", c + 1);
      int len = strlen(c + 1);
      if (c[1] != c[len]) {
        k1 = 0;
        k2 = 0;
        for (register int i = 1; i <= len; ++i) {
          k1 = (k1 * 2 + c[i] - '0') % 998244353;
        }
        for (register int i = len; i >= 1; --i) {
          k2 = (k2 * 2 + c[i] - '0') % 998244353;
        }
        if (c[1] == '0')
          a[++tot] = {k1, k2, i};
        else
          ma[k1] = i;
      } else if (c[1] == '0')
        ++num1;
      else
        ++num2;
    }
    s1 = tot;
    s2 = ma.size();
    if (num1 && num2 && s1 == 0 && s2 == 0) {
      puts("-1");
      continue;
    } else {
      for (register int i = 1; i <= n; ++i) f[i] = 0;
      for (register int i = 1; i <= s1; ++i) {
        k = a[i].k2;
        if (ma.count(k)) f[a[i].id] = 1, f[ma[k]] = 1;
      }
      k = (abs(s1 - s2)) >> 1;
      printf("%d\n", k);
      if (s1 > s2) {
        for (register int i = 1; i <= s1, k; ++i)
          if (!f[a[i].id]) {
            printf("%d ", a[i].id);
            --k;
          }
      } else {
        for (auto &i : ma)
          if (!f[i.second] && k) {
            printf("%d ", i.second);
            --k;
          }
      }
      puts("");
    }
  }
}
