#include <bits/stdc++.h>
using namespace std;
using u1 = bool;
using u8 = char;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
template <class T>
using V = vector<T>;
template <class T>
using Q = queue<T>;
template <class T>
using S = set<T>;
template <class K, class V>
using M = map<K, V>;
template <class K, class V>
using UM = unordered_map<K, V>;
void solve(i32 n, V<string> &&v) {
  unordered_map<string, i32> M;
  u1 flag11 = false;
  u1 flag00 = false;
  u1 flag2 = false;
  i32 balance = 0;
  V<u1> blocked(n, false);
  for (i32 i = 0; i < n; ++i) {
    string &s = v[i];
    if (s[0] == s.back()) {
      if (s[0] == '1') {
        flag11 = true;
      } else {
        flag00 = true;
      }
      continue;
    }
    flag2 = true;
    if (s[0] == '1' && s.back() == '0') {
      balance++;
    } else {
      balance--;
    }
    string s1 = s;
    reverse(s1.begin(), s1.end());
    if (M.count(s1)) {
      blocked[M[s1]] = true;
      blocked[i] = true;
    } else {
      M[s] = i;
    }
  }
  V<i32> to_turn;
  for (i32 i = 0; i < n && abs(balance) > 1; ++i) {
    string &s = v[i];
    if (s[0] == s.back() || blocked[i]) continue;
    if (balance > 0 && s[0] == '1') {
      balance -= 2;
      to_turn.push_back(i);
    } else if (balance < 0 && s[0] == '0') {
      balance += 2;
      to_turn.push_back(i);
    }
  }
  if (abs(balance) > 1 || (flag00 && flag11 && !flag2)) {
    cout << -1 << endl;
  } else {
    cout << to_turn.size() << endl;
    for (auto i : to_turn) cout << i + 1 << " ";
    cout << endl;
  }
}
int main() {
  i32 Q;
  cin >> Q;
  for (i32 q = 0; q < Q; ++q) {
    i32 n;
    cin >> n;
    V<string> v(n);
    for (auto &s : v) cin >> s;
    solve(n, move(v));
  }
}
namespace {
auto fast_io = [] {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return 0;
}();
}
