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

#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n;
    cin >> t;
    while(t--){
        cin >> n;
        vector<ll> ar(n);
        for(int i = 0; i<n; i++) cin >> ar[i];
        map<ll, ll> mp;
        for(int i = 0; i<n; i++){
            if(mp.find(ar[i]) == mp.end()) mp[ar[i]] = 1;
            else mp[ar[i]] = 0;
        }
        int ans = -1, f = 1;
        map<ll, ll> :: iterator it;
        for(it = mp.begin(); f==1 && it != mp.end(); it++){
            if(it->second == 1){
                for(int j = 0; j<n; j++){
                    if(ar[j] == it->first){
                        ans = j+1;
                        f = 0;
                        break;
                    }
                }
            }
        }
        cout<< ans<<"\n";
    }

    return 0;
}