#include<bits/stdc++.h> 
using namespace std; 

using ll = long long;
void solve();
template <typename T>
void display_vec(T &vec){
    for(auto i:vec){
        cout<<i<<" ";
    }
    cout<<"\n";
}
template <typename T>
void display_arr(T *arr,int n){
    for(int i=0;i<n;i++){
        cout<<*arr<<" ";
        arr++;
    }
    cout<<"\n";
}
void reduce(vector<int> &vec){
    vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
}
void readArr(ll arr[],int n){
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
}
void solve(){
    int n;
    cin>>n;
    ll arr[n];
    readArr(arr,n);
    int n1=1,n2=0,ans;
    for(int i=1;i<n;i++){
        if(arr[i]!=arr[0]){
            n2++;
        }
        else{
            n1++;
        }
    }
    if(n1==1){
        ans = 0;
    }
    else{
        for(int i=1;i<n;i++){
            if(arr[i]!=arr[0]){
                ans = i;
                break;
            }
        }
    }
    cout<<ans+1<<"\n";
}

