// Problem Link : https://codeforces.com/contest/1454/problem/B

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

int main() {
    int t;
    cin>>t;
    while(t--) {
        int n;
        cin>>n;
        int arr[n];
        map<int, int> mp;
        for(int i=0;i<n;i++) {
            cin>>arr[i];
            mp[arr[i]]++;
        }

        int res = INT_MAX, index=-1;
        for(int i=0;i<n;i++) {
            if(mp[arr[i]] == 1){
                if(res > arr[i]) {
                    res = arr[i];
                    index = i + 1;
                }
            }
        }

        cout<<index<<endl;
    }

    return 0;
}