#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    set<string> st;
    string a[n];
    long long cnt01 = 0;
    long long cnt10 = 0;
    long long cnt00 = 0;
    long long cnt11 = 0;
    for (long long i = 0; i < n; ++i) {
      cin >> a[i];
      st.insert(a[i]);
      if (a[i][0] == '0' && a[i][a[i].length() - 1] == '1') {
        cnt01++;
      }
      if (a[i][0] == '1' && a[i][a[i].length() - 1] == '0') {
        cnt10++;
      }
      if (a[i][0] == '1' && a[i][a[i].length() - 1] == '1') {
        cnt11++;
      }
      if (a[i][0] == '0' && a[i][a[i].length() - 1] == '0') {
        cnt00++;
      }
    }
    if (abs(cnt01 - cnt10) <= 1) {
      if (cnt10 == cnt01 && 0 == cnt10) {
        if (cnt00 == 0 || cnt11 == 0) {
          cout << 0 << "\n";
          continue;
        } else {
          cout << -1 << "\n";
          continue;
        }
      }
      cout << 0 << "\n";
      continue;
    }
    if (cnt01 > cnt10) {
      long long need = (cnt01 - cnt10) / 2;
      long long donttouch = 0;
      bool dont[n];
      for (long long j = 0; j < n; ++j) {
        dont[j] = true;
      }
      for (long long i = 0; i < n; ++i) {
        if (a[i][0] == '0' && a[i][a[i].length() - 1] == '1') {
          reverse(a[i].begin(), a[i].end());
          if (st.count(a[i]) == 1) {
            donttouch++;
          } else {
            dont[i] = false;
          }
          reverse(a[i].begin(), a[i].end());
        }
      }
      if (cnt01 - donttouch < need) {
        cout << -1 << "\n";
        continue;
      } else {
        cout << need << "\n";
        for (long long i = 0; i < n; ++i) {
          if (!dont[i]) {
            cout << i + 1 << " ";
            need--;
            if (need == 0) break;
          }
        }
        cout << "\n";
        continue;
      }
    } else if (cnt10 > cnt01) {
      long long need = (cnt10 - cnt01) / 2;
      long long donttouch = 0;
      bool dont[n];
      for (long long j = 0; j < n; ++j) {
        dont[j] = true;
      }
      for (long long i = 0; i < n; ++i) {
        if (a[i][0] == '1' && a[i][a[i].length() - 1] == '0') {
          reverse(a[i].begin(), a[i].end());
          if (st.count(a[i]) == 1) {
            donttouch++;
          } else {
            dont[i] = false;
          }
          reverse(a[i].begin(), a[i].end());
        }
      }
      if (cnt10 - donttouch < need) {
        cout << -1 << "\n";
        continue;
      } else {
        cout << need << "\n";
        for (long long i = 0; i < n; ++i) {
          if (!dont[i]) {
            cout << i + 1 << " ";
            need--;
            if (need == 0) break;
          }
        }
        cout << "\n";
        continue;
      }
    }
  }
}
