#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    V<P<int, string> > zerone, onezero;
    int zz = 0, oo = 0;
    set<string> zo, oz;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      if (s[0] == '0') {
        if (s[s.size() - 1] == '1') {
          zerone.emplace_back(i, s);
          zo.insert(s);
        } else
          zz++;
      } else if (s[0] == '1') {
        if (s[s.size() - 1] == '0') {
          onezero.emplace_back(i, s);
          oz.insert(s);
        }
        oo++;
      }
    }
    if (zerone.empty() && onezero.empty()) {
      if (zz > 0 && oo > 0)
        cout << -1 << '\n';
      else {
        cout << 0 << '\n';
        cout << '\n';
      }
    } else if (zerone.empty()) {
      int sz = onezero.size() >> 1;
      if (sz == 0) {
        cout << 0 << '\n';
        cout << '\n';
      } else {
        cout << sz << '\n';
        for (int i = 0; i < sz; i++)
          cout << onezero[i].first + 1 << (i == sz - 1 ? '\n' : ' ');
      }
    } else if (onezero.empty()) {
      int sz = zerone.size() >> 1;
      if (sz == 0) {
        cout << 0 << '\n';
        cout << '\n';
      } else {
        cout << sz << '\n';
        for (int i = 0; i < sz; i++)
          cout << zerone[i].first + 1 << (i == sz - 1 ? '\n' : ' ');
      }
    } else {
      if (onezero.size() == zerone.size()) {
        cout << 0 << '\n';
        cout << '\n';
      } else if (onezero.size() + 1 == zerone.size()) {
        cout << 0 << '\n';
        cout << '\n';
      } else if (onezero.size() == zerone.size() + 1) {
        cout << 0 << '\n';
        cout << '\n';
      } else {
        if (onezero.size() < zerone.size()) {
          int sz = ((int)zerone.size() - (int)onezero.size()) / 2;
          V<int> ans;
          int i = 0;
          while (ans.size() < sz && i < zerone.size()) {
            string tmps = zerone[i].second;
            reverse(tmps.begin(), tmps.end());
            if (oz.find(tmps) == oz.end()) {
              ans.emplace_back(zerone[i].first + 1);
            }
            i++;
          }
          if (ans.size() < sz)
            cout << -1 << '\n';
          else {
            cout << ans.size() << '\n';
            for (int i = 0; i < ans.size(); i++)
              cout << ans[i] << (i == ans.size() - 1 ? '\n' : ' ');
          }
        } else {
          int sz = ((int)onezero.size() - (int)zerone.size()) / 2;
          V<int> ans;
          int i = 0;
          while (ans.size() < sz && i < onezero.size()) {
            string tmps = onezero[i].second;
            reverse(tmps.begin(), tmps.end());
            if (zo.find(tmps) == zo.end()) {
              ans.emplace_back(onezero[i].first + 1);
            }
            i++;
          }
          if (ans.size() < sz)
            cout << -1 << '\n';
          else {
            cout << ans.size() << '\n';
            for (int i = 0; i < ans.size(); i++)
              cout << ans[i] << (i == ans.size() - 1 ? '\n' : ' ');
          }
        }
      }
    }
  }
  return 0;
}
