#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mpi map<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define pl pair<ll,ll>
#define pi pair<int,int>
#define forn(i,n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf       1000000000000
#define MOD       1000000007
ll binpow(ll a,ll b,ll m){
    a%=m;
    ll res=1;
    while(b>0){
        if(b&1)
            res=res*a%m;
        a=a*a%m;
        b>>=1;
    }
    return res;
}
void solve(){
    ll n,a;
    cin>>n;
    map<ll,vl> m;
    for(ll i=1;i<=n;i++){
        cin>>a;
        m[a].pb(i);
    }
    for(auto i:m){
        if(i.ss.size()==1){
            cout<<i.ss[0];
            return;
        }
    }
    cout<<-1;
}

int main() {
    ll t=1;
    cin>>t;
    while(t--){
        solve();
		cout<<endl;
    }
    return 0;
}