#include <bits/stdc++.h>
using namespace std;
int t;
int p1[200001], p2[200001];
string s[200001];
int b[200001];
int dis[5][5];
map<string, int> p;
bool pd(int k) {
  int temp = s[k].size();
  string ef = "";
  for (int i = temp - 1; i >= 0; i--) ef += s[k][i];
  if (!p[ef]) {
    p[s[k]] = 0;
    p[ef] = 1;
    return 0;
  }
  return 1;
}
int main() {
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int t1 = 0, t2 = 0;
    memset(dis, 0, sizeof(dis));
    p.clear();
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      p[s[i]] = 1;
      int temp = s[i].size();
      p1[i] = s[i][0] - '0';
      p2[i] = s[i][temp - 1] - '0';
      dis[p1[i]][p2[i]]++;
    }
    if (!dis[0][1] && !dis[1][0] && dis[0][0] && dis[1][1]) {
      printf("-1\n");
      continue;
    }
    int ans = 0;
    int flag = 0;
    if (dis[0][1] < dis[1][0])
      flag = 0;
    else
      flag = 1;
    int toq = (dis[0][1] + dis[1][0]) / 2;
    int op = 1;
    while (dis[flag][flag ^ 1] != toq && op <= n) {
      if (p1[op] != p2[op] && p1[op] != flag && !pd(op)) {
        ans++;
        b[ans] = op;
        dis[flag][flag ^ 1]++;
      }
      op++;
    }
    cout << ans << endl;
    for (int i = 1; i <= ans; i++) {
      printf("%d ", b[i]);
    }
    cout << endl;
  }
  return 0;
}
