#include <bits/stdc++.h>
using namespace std;
using ll = signed long long int;
using st = list<int>;
const int N = 1e6 + 100;
st ms[2];
map<string, st::iterator> mp;
int n;
bool type, exist[2], alt;
string s, rs;
vector<int> res;
bool go() {
  res.clear();
  if (exist[0] && exist[1] &&
      (alt || !ms[0].empty() || !ms[1].empty()) == false) {
    return false;
  }
  st::iterator it;
  int s1, s2;
  if (ms[0].size() > ms[1].size()) {
    s1 = ms[0].size();
    s2 = ms[1].size();
    it = ms[0].begin();
  } else {
    s1 = ms[1].size();
    s2 = ms[0].size();
    it = ms[1].begin();
  }
  while ((s1 - s2) > 1) {
    res.push_back(*it + 1);
    it++;
    s1--, s2++;
  }
  return true;
}
void solve() {
  ms[0].clear();
  ms[1].clear();
  mp.clear();
  exist[0] = exist[1] = alt = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    type = s.front() == '1';
    if (s.back() == s.front()) {
      exist[type] = true;
      continue;
    }
    if (s[0] == '1') {
      rs.resize(s.size());
      for (int si = 0, ri = s.size() - 1; ri >= 0; ri--, si++) {
        rs[ri] = s[si];
      }
    }
    string &w = s[0] == '0' ? s : rs;
    auto it = mp.find(w);
    if (it == mp.end()) {
      ms[type].push_back(i);
      mp[w] = --ms[type].end();
    } else {
      ms[!type].erase(it->second);
      mp.erase(it);
      alt = true;
    }
  }
  if (!go()) {
    cout << "-1";
  } else {
    cout << res.size() << '\n';
    for (auto y : res) {
      cout << y << ' ';
    }
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
}
