// i guess i was just lucky 
// but does it even matters now

#include<bits/stdc++.h>
using namespace std; 
 
#define FAST_I0 ios_base::sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"
#define int long long 
#define vvi vector<int>
#define pb push_back

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 



void think(){
int n;
cin >> n;
unordered_map<int , int> mp;
vvi a(n);
for(int i =0; i<n; i++){
cin >> a[i];
mp[a[i]]++;
	}
	int target = 100000000;
	for(auto i : mp){
		if(i.second == 1){
			target = min(target,i.first);
			}
		}
		if(target == 100000000){
			cout << -1 << endl;
			return;
			}
		for(int i = 0; i<n; i++){
			if(a[i] == target){
				cout << i+1 << endl;
				return;
				}
			}
}

int32_t main(){
	FAST_I0; 
	int testcase = 1; 
	cin >> testcase;
	while(testcase--){
		think();
		}
	return 0;	

}
