#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> vv[5];
map<string, int> aaa;
int vis[maxn], ans[maxn];
void add(string s, int len, int id) {
  if (s[0] == '0' && s[len - 1] == '0') vv[0].push_back(id);
  if (s[0] == '0' && s[len - 1] == '1') vv[1].push_back(id);
  if (s[0] == '1' && s[len - 1] == '0') vv[2].push_back(id);
  if (s[0] == '1' && s[len - 1] == '1') vv[3].push_back(id);
}
int solve() {
  int n;
  cin >> n;
  for (int i = 1; i < n + 1; ++i) vis[i] = 0;
  aaa.clear();
  memset(vv, 0, sizeof(vv));
  for (int i = 1; i < n + 1; ++i) {
    string s;
    cin >> s;
    int len = s.length();
    add(s, len, i);
    aaa[s] = i;
    reverse(s.begin(), s.end());
    if (aaa.count(s))
      vis[aaa[s]] = 1, vis[i] = 1;
    else
      vis[i] = 0;
  }
  int sz[5];
  memset(sz, 0, sizeof(sz));
  for (int i = 0; i < 4; ++i) sz[i] = vv[i].size();
  if (!sz[1] && !sz[2]) {
    if (!sz[0] || !sz[3]) return cout << "0\n", 0;
    return cout << "-1\n", 0;
  } else {
    pair<int, int> p;
    p = sz[1] > sz[2] ? pair<int, int>(sz[1] - sz[2], 1)
                      : pair<int, int>(sz[2] - sz[1], 2);
    p.first /= 2;
    for (int i = 0; i < n; ++i) ans[i] = 0;
    int cnt(0);
    for (int i = 0; i < sz[p.second]; ++i) {
      if (!p.first) break;
      if (!vis[vv[p.second][i]]) {
        ans[cnt++] = vv[p.second][i];
        p.first--;
      }
    }
    if (p.first)
      return cout << "-1\n", 0;
    else {
      cout << cnt << '\n';
      for (int i = 0; i < cnt; ++i) cout << ans[i] << ' ';
      return cout << '\n', 0;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  int _;
  cin >> _;
  while (_--) solve();
}
