#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
 
int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int tc;
    cin >> tc;
    while(tc--){
    	int n;
    	cin>>n;
    	vector<int> a(n);
    	unordered_map<int,vector<int>> mp;
    	// {ind, count}
    	for(int i=0; i<n; ++i){
    		cin>>a[i];
    		if(mp.find(a[i])==mp.end()){
	    		mp[a[i]].push_back(i+1);
	    		mp[a[i]].push_back(1);
	    	}
	    	else
	    		mp[a[i]][1]++;
    	}
    	int flag = 0;
    	int ans = INT_MAX;
    	int ans_ind;
    	for(auto x:mp){
    		if(x.second[1]==1){
    			flag = 1;
    			if(x.first<ans){
    				ans = x.first;
    				ans_ind = x.second[0];
    			}
    		}
    	}
    	if(flag==1)
    		cout<<ans_ind<<endl;
    	else
    		cout<<-1<<endl;

    }
    return 0;
}