#ifdef ONLINE_JUDGE #pragma GCC optimize(3, "Ofast", "inline") #endif #include #include #include #define rt return #define pi pair #define pl pair #define pu pair #define int long long #define ll long long #define ull unsigned long long #define endl '\n' #define Endl endl #define all(x) x.begin(), x.end() #define all1(x) next(x.begin()), x.end() #define lll __int128_t #define ulll __uint128_t using namespace std; const int maxn = 1e5 + 50; const int mod = 998244353; const ll maxl = 2e18 + 5; const int maxi = 1e9 + 7; struct LinearBase { // ????? idx?1?? // ????? idx?0?? int N; vector base; vector idx; int iffzero = 0; LinearBase() { N = 105; base.resize(102); } LinearBase(int n) { N = n + 5; base.resize(n + 20); idx.resize(n + 20); } void clear() { N = 0; base.clear(); } bool insert(ull x, int dx) { assert(N != 0); for (int i = 62; i >= 0; i--) { if (!(x & (1ull << i))) continue; if (!base[i]) { base[i] = x; idx[i] = dx; return 1; } x ^= base[i]; if (x == 0) { iffzero = 1; return false; } } return 1; } void goass() { assert(N != 0); sort(base.begin(), base.end(), greater()); int row = 0; for (int i = 62; i >= 0; i--) { for (int j = row; j < N; j++) { if ((1ull << i) & base[j]) { swap(base[j], base[row]); } } if (!((1ull << i) & base[row])) continue; for (int j = 0; j < N; j++) { if (j == row) continue; if ((1ull << i) & base[j]) { base[j] ^= base[row]; } } row++; } } void printbi(ull x) { for (int j = 62; j >= 0; j--) { if ((1ull << j) & x) { cerr << 1; } else cerr << 0; } cerr << endl; } void print() { assert(N != 0); for (int i = 0; i < N; i++) { for (int j = 62; j >= 0; j--) { if ((1ull << j) & base[i]) { cerr << 1; } else cerr << 0; } cerr << endl; } cerr << endl; } }; void init() { } void solve() { int n; cin >> n; vector a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i]; LinearBase lb(105); vector ans; for (int i = 1; i <= n; i++) { if (!lb.insert(a[i], i)) { ull x = a[i]; for (int j = 62; j >= 0; j--) { if (!(x & (1ull << j))) continue; x ^= lb.base[j]; if(lb.idx[j]!=0) ans.push_back(lb.idx[j]); } ans.push_back(i); break; } } if(ans.empty()) { cout<<-1<> __; init(); while (__--) { solve(); // cerr<<"TIME"<