#include <bits/stdc++.h>
using namespace std;
void bsv(vector<int>& ans, set<int>& a, set<int>& b, bool eql) {
  while (a.size() > b.size() + eql) {
    ans.emplace_back(*a.begin());
    b.emplace(*a.begin());
    a.erase(a.begin());
  }
  while (b.size() > a.size() + eql) {
    ans.emplace_back(*b.begin());
    a.emplace(*b.begin());
    b.erase(b.begin());
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    map<string, int> s;
    set<int> s01;
    set<int> s10;
    set<int> s00;
    set<int> s11;
    int rc01 = 0;
    int rc10 = 0;
    for (int i = 1; i <= n; i++) {
      string t;
      cin >> t;
      if (t[0] == '0' && t.back() == '0')
        s00.emplace(i);
      else if (t[0] == '1' && t.back() == '1')
        s11.emplace(i);
      else {
        if (t[0] == '0' && t.back() == '1')
          rc01++;
        else
          rc10++;
        string ret = t;
        reverse(ret.begin(), ret.end());
        if (s.count(ret)) {
          if (t[0] == '0' && t.back() == '1')
            s10.erase(s[ret]);
          else
            s01.erase(s[ret]);
          s.erase(ret);
          continue;
        }
        if (t[0] == '0' && t.back() == '1')
          s01.emplace(i);
        else
          s10.emplace(i);
        s[t] = i;
      }
    }
    vector<int> ans;
    if (s11.empty() || s00.empty()) {
      if ((s01.size() + s10.size()) & 1)
        bsv(ans, s01, s10, true);
      else
        bsv(ans, s01, s10, false);
    } else {
      if (!rc10 && !rc01) {
        cout << "-1\n";
        continue;
      }
      if ((s01.size() + s10.size()) & 1)
        bsv(ans, s01, s10, true);
      else
        bsv(ans, s01, s10, false);
    }
    cout << ans.size() << "\n";
    for (auto it : ans) cout << it << " ";
    cout << "\n";
  }
  return 0;
}
