#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const long long int mod = 1000000007;
const long long int inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const double PI = acos(-1);
long long int i, j, k;
void solve(void);
inline bool equal(double a, double b) { return fabs(a - b) < eps; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int t = 1;
  cin >> t;
  while (t--) solve();
  ;
  ;
  return 0;
}
void solve() {
  long long int n;
  cin >> n;
  string s[n];
  for (i = 0; i <= n - 1; ++i) cin >> s[i];
  map<string, vector<string> > cnteach, uniquerev;
  map<string, int> pre, idx;
  string s1 = "00", s2 = "01", s3 = "10", s4 = "11";
  for (i = 0; i <= n - 1; ++i) {
    int len = (int)s[i].size();
    pre[s[i]] = 1;
    idx[s[i]] = i;
    int b = s[i][0], e = s[i][len - 1];
    if (b == '0' && e == '0')
      cnteach[s1].emplace_back(s[i]);
    else if (b == '0' && e == '1')
      cnteach[s2].emplace_back(s[i]);
    else if (b == '1' && e == '0')
      cnteach[s3].emplace_back(s[i]);
    else
      cnteach[s4].emplace_back(s[i]);
  }
  int sz00 = (int)cnteach[s1].size(), sz01 = (int)cnteach[s2].size(),
      sz10 = (int)cnteach[s3].size(), sz11 = (int)cnteach[s4].size();
  for (auto it : cnteach[s2]) {
    string temp = it;
    reverse(temp.begin(), temp.end());
    if (!pre[temp]) uniquerev[s2].emplace_back(it);
  }
  for (auto it : cnteach[s3]) {
    string temp = it;
    reverse(temp.begin(), temp.end());
    if (!pre[temp]) uniquerev[s3].emplace_back(it);
  }
  if (sz01 == sz10 && sz01 == 0) {
    if (sz00 > 0 && sz11 > 0) {
      cout << "-1\n";
      return;
    }
    cout << "0\n";
    return;
  }
  if (sz00 == 0 && sz11 == 0) {
    if (sz01 > sz10) {
      int ct = (sz01 - sz10) / 2;
      if (ct > (int)uniquerev[s2].size()) {
        cout << "-1\n";
        return;
      }
      cout << ct << '\n';
      for (i = 0; i <= ct - 1; ++i) {
        int id = idx[uniquerev[s2][i]];
        cout << id + 1 << ' ';
      }
      cout << '\n';
      return;
    } else {
      int ct = (sz10 - sz01) / 2;
      if (ct > (int)uniquerev[s3].size()) {
        cout << "-1\n";
        return;
      }
      cout << ct << '\n';
      for (i = 0; i <= ct - 1; ++i) {
        int id = idx[uniquerev[s3][i]];
        cout << id + 1 << ' ';
      }
      cout << '\n';
      return;
    }
  }
  if (sz01 > sz10) {
    int ct = (sz01 - sz10) / 2;
    if (ct > (int)uniquerev[s2].size()) {
      cout << "-1\n";
      return;
    }
    cout << ct << '\n';
    for (i = 0; i <= ct - 1; ++i) {
      int id = idx[uniquerev[s2][i]];
      cout << id + 1 << ' ';
    }
    cout << '\n';
    return;
  } else {
    int ct = (sz10 - sz01) / 2;
    if (ct > (int)uniquerev[s3].size()) {
      cout << "-1\n";
      return;
    }
    cout << ct << '\n';
    for (i = 0; i <= ct - 1; ++i) {
      int id = idx[uniquerev[s3][i]];
      cout << id + 1 << ' ';
    }
    cout << '\n';
    return;
  }
}
