#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
    int t;
    cin>>t;

    for(int i=0;i<t;i++){
        int n;
        cin>>n;
        int min_seen = 100000000;
        map<int,int> a;
        map<int,int> pos;
        int res_index = -1;
        int res = -1;
        for( int j=1;j<=n;j++){
            int k;
            cin>>k;
            if( a.count(k) == 1 ){
                a[k] = a[k]+1;
                pos[k] = j;
            }else{
                a[k] = 1;
                pos[k] = j;
            }
        }
        for(auto i:a){
            if( i.first<min_seen && i.second ==1 ){
               res = i.first;
               min_seen = i.first; 
            }
        }
        if( res > 0 ){
        cout<<pos[res]<<endl;
        }else{
            cout<<-1<<endl;
        }

}
}