#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	int t;
	cin >> t;
	
	for (int i = 0; i < t; i++) {
		int n, a1, a2, p;
		multiset <int> s;
		cin >> n;
		
		for (int j = 1; j <= n; j++) {
			int x;
			cin >> x;
			if (j == 1)	a1 = x;
			else if (x != a1) {
				a2 = x;
				p = j;
			}
			s.insert(x);
		}
		
		if (s.count(a1) > s.count (a2)) cout << p << "\n";
		else cout << 1 << "\n";
	}
	
	return 0; 
}
