#include <bits/stdc++.h>
using namespace std;
const int d1 = 7;
const int d2 = 29;
const int mod = 19260817;
char str[200005];
bool h1[mod + 5], h2[mod + 5];
int r1[200005], r2[200005];
int kf[4][200005];
int check[200005][2];
int fff[200005];
bool ban[200005];
int main() {
  int t, n;
  scanf("%d", &t);
  while (t--) {
    int cnt[4] = {0, 0, 0, 0};
    int move[4] = {0, 0, 0, 0};
    int n, len;
    scanf("%d", &n);
    int p1 = 0, p2 = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%s", str + 1);
      int len = strlen(str + 1);
      int type = (str[1] - '0') * 2 + str[len] - '0';
      kf[type][++cnt[type]] = i;
      fff[i] = type;
      int a = 0, b = 0;
      for (int j = 1; j <= len; j++) {
        a = (a * d1 + str[j] - 5) % mod;
        b = (b * d2 + str[j] - 19) % mod;
      }
      h1[r1[++p1] = a] = h2[r2[++p2] = b] = 1;
      a = b = 0;
      for (int j = len; j >= 1; j--) {
        a = (a * d1 + str[j] - 5) % mod;
        b = (b * d2 + str[j] - 19) % mod;
      }
      check[i][0] = a;
      check[i][1] = b;
    }
    for (int i = 1; i <= n; i++)
      if (h1[check[i][0]] && h2[check[i][1]])
        ban[i] = 1;
      else
        move[fff[i]]++;
    if (cnt[1] == 0 && cnt[2] == 0 && cnt[3] != 0 && cnt[0] != 0)
      printf("-1\n");
    else if (cnt[1] == cnt[2])
      printf("0\n\n");
    else if (cnt[1] > cnt[2]) {
      int ned = (cnt[1] - cnt[2]) / 2;
      if (ned > move[1])
        printf("-1\n");
      else {
        printf("%d\n", ned);
        for (int i = 1, ooo = 1; ooo <= ned; ooo++, i++) {
          while (ban[kf[1][i]]) {
            i++;
          }
          printf("%d ", kf[1][i]);
        }
        printf("\n");
      }
    } else if (cnt[2] > cnt[1]) {
      int ned = (cnt[2] - cnt[1]) / 2;
      if (ned > move[2])
        printf("-1\n");
      else {
        printf("%d\n", ned);
        for (int i = 1, ooo = 1; ooo <= ned; ooo++, i++) {
          while (ban[kf[2][i]]) {
            i++;
          }
          printf("%d ", kf[2][i]);
        }
        printf("\n");
      }
    }
    for (int i = 1; i <= n; i++) ban[i] = 0;
    for (int i = 1; i <= p1; i++) h1[r1[i]] = 0;
    for (int i = 1; i <= p2; i++) h2[r2[i]] = 0;
  }
  return 0;
}
