#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &V);
template <typename T>
ostream &operator<<(ostream &out, const set<T> &S);
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P);
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const map<T1, T2> &M);
void testcase() {
  int n;
  cin >> n;
  vector<string> A(n + 1);
  map<string, vector<int> > M;
  set<string> S;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    M[to_string(A[i][0] - '0') + to_string(A[i][A[i].size() - 1] - '0')]
        .push_back(i);
    S.insert(A[i]);
  }
  if (n == 1) {
    cout << 0 << endl << endl;
    return;
  }
  bool zz = !M["00"].empty(), oo = !M["11"].empty();
  int ans;
  vector<int> Ans, V;
  if (!zz && !oo) {
    int s01 = M["01"].size(), s10 = M["10"].size();
    if (s01 >= s10) {
      ans = (s01 - s10) / 2;
      V = M["01"];
    } else {
      ans = (s10 - s01) / 2;
      V = M["10"];
    }
  } else if (zz && !oo) {
    int s01 = M["01"].size(), s10 = M["10"].size();
    ans = (abs(s10 - s01)) / 2;
    V = (s10 >= s01) ? M["10"] : M["01"];
  } else if (!zz && oo) {
    int s01 = M["01"].size(), s10 = M["10"].size();
    ans = (abs(s01 - s10)) / 2;
    V = (s01 >= s10) ? M["01"] : M["10"];
  } else {
    int s01 = M["01"].size(), s10 = M["10"].size();
    if ((s01 + s10) == 0) {
      cout << -1 << endl;
      return;
    }
    ans = abs((s01 - s10) / 2);
    V = (s01 >= s10) ? M["01"] : M["10"];
  }
  for (int i = 0; i < V.size() && Ans.size() < ans; i++) {
    string t = A[V[i]];
    reverse(t.begin(), t.end());
    if (S.find(t) == S.end()) {
      Ans.push_back(V[i]);
    }
  }
  if (Ans.size() < ans) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
    for (int i = 0; i < ans; i++) {
      cout << Ans[i] << " ";
    }
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int T = 1;
  cin >> T;
  for (int t = 0; t < T; t++) {
    testcase();
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &V) {
  if (!V.empty()) {
    out << "{";
    for (auto v : V) out << v << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const set<T> &S) {
  if (!S.empty()) {
    out << "set{";
    for (auto v : S) out << v << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const map<T1, T2> &M) {
  if (!M.empty()) {
    out << "map{";
    for (auto &kv : M)
      out << "(" << kv.first << ": " << kv.second << ")"
          << ", ";
    out << "\b\b}";
  } else {
    out << "{}";
  }
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P) {
  out << "{" << P.first << ", " << P.second << "}";
  return out;
}
