#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
#define ll long long
using namespace std;

int main()
{
    fastio
    int gec;   cin>> gec;
    while(gec--){
        int n,a[200000],flag=0,p=1e6,q;
        map<int, int> mp;
        cin>>n;
        for(int i=1;i<=n;i++) {
            cin>>a[i];
            mp[a[i]]++;
        }
        for(auto x : mp){
            if(x.second==1){
                flag=1;
                if(x.first<p) p=x.first;
            }
        }
        for(int i=1;i<=n;i++){
            if(a[i]==p) {q=i; break;}
        }
        if(flag==0) cout<<-1<<endl;
        else cout<<q<<endl;
    }
}