#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
void solve(){
	int n; cin >> n;
	map<int,int>mp;
	vi v(n); fr(i,n) cin >> v[i],mp[v[i]]++;
	bool ok = 0;
	for(auto &pr: mp)ok |= pr.second == 1;
	if(!ok) {cout << "-1\n"; return;}
	// nl;
	pair<int,int>winer{1e9,19};
	fr(i,n){
		if(mp[v[i]] > 1) continue;
		winer = min(winer, {v[i] , i});
	}
	cout << winer.second + 1; nl;

	
}
int32_t main()
{
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int tst; cin >> tst; while(tst--){
   	solve();
   }
}