#include <bits/stdc++.h>
using namespace std;
int32_t seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline int32_t rnd(int32_t l = 0, int32_t r = INT_MAX) {
  return uniform_int_distribution<int32_t>(l, r)(rng);
}
template <typename T, typename G>
ostream& operator<<(ostream& out, const pair<T, G>& a) {
  return out << "(" << a.first << " , " << a.second << ")";
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
  out << "[";
  for (const auto& i : a) out << i << " , ";
  return out << "]" << endl;
}
template <typename T>
ostream& operator<<(ostream& out, const set<T>& a) {
  out << "{";
  for (const auto& i : a) out << i << " , ";
  return out << "}" << endl;
}
template <typename T, typename G>
ostream& operator<<(ostream& out, const map<T, G>& a) {
  out << "<";
  for (const auto& i : a) out << i << " , ";
  return out << ">" << endl;
}
template <typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
                   ostream&>::type
operator<<(ostream& out, T (&a)[N]) {
  out << '[';
  for (size_t i = 0; i < N; ++i) out << a[i] << " , ";
  out << "]" << endl;
  return out;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int32_t t;
  cin >> t;
  while (t--) {
    int32_t n, i;
    cin >> n;
    map<string, int32_t> mp;
    set<int32_t> sz, so;
    string s, t;
    int32_t oo = 0, tt = 0, cn = 0;
    for (i = 1; i <= n; i++) {
      cin >> s;
      t = s;
      reverse(t.begin(), t.end());
      if (t[0] == s[0]) {
        if (t[0] == '1')
          tt++;
        else
          oo++;
        continue;
      }
      int32_t j = mp[t];
      if (j) {
        if (t[0] == '0')
          sz.erase(j);
        else
          so.erase(j);
        cn++;
      } else {
        mp[s] = i;
        if (s[0] == '0')
          sz.insert(i);
        else
          so.insert(i);
      }
    }
    if (oo > 0 && tt > 0 && ((int32_t)sz.size() + (int32_t)(so.size())) == 0 &&
        !(cn > 0)) {
      cout << "-1\n";
      continue;
    }
    int32_t dff = abs((int32_t)sz.size() - (int32_t)so.size()) / 2;
    vector<int32_t> ans;
    if (sz.size() > so.size()) {
      for (auto u : sz) {
        if (dff == 0) break;
        ans.push_back(u);
        dff--;
      }
    } else {
      for (auto u : so) {
        if (dff == 0) break;
        ans.push_back(u);
        dff--;
      }
    }
    cout << ans.size() << "\n";
    for (auto u : ans) cout << u << " ";
    cout << "\n";
  }
  return 0;
}
