#include<iostream>
#include<algorithm>
using namespace std;
class node{
    public:
        int a;
        int b;
};
bool com(node a,node b){
    return a.a<b.a;
}
int main(){
    int times=0;
    cin>>times;
    while(times--){
        int t=0;
        cin>>t;
        node *arr=new node[t+5]();
        for(int i=0;i<t;i++){
            scanf("%d",&arr[i].a);
            arr[i].b=i+1;
        }
        if(t==1){
            cout<<arr[0].a<<endl;
            continue;
        }
        sort(arr,arr+t,com);
        bool fl=false;
        for(int i=0;i<t;i++){
            if(i==0){
                if(arr[i].a!=arr[i+1].a){
                    cout<<arr[i].b<<endl;
                    fl=true;
                    break;
                }
            }
            if(i==t-1){
                if(arr[i].a!=arr[i-1].a){
                    cout<<arr[i].b<<endl;
                    fl=true;
                    break;
                }
            }
            if(arr[i].a!=arr[i+1].a&&arr[i].a!=arr[i-1].a){
                cout<<arr[i].b<<endl;
                    fl=true;
                    break;
            }
        }
        if(!fl)
        cout<<-1<<endl;
    }
    return 0;
}