#include<bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
#define fb(i,a,n,b) for(int i=a ; i<n ; i+=b)
#define f(i,a,n) for(int i=a ; i<n ; i++)
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int t;
    std::cin >> t ;
    while (t--) {
        int n;
        std::cin >> n ;
        std::map<int,int> m, p;
        f(i,0,n){
            int a;
            cin >> a;
            m[a]++;
            p[a] = i;
        }
        int ans = -1;
        for (auto [num, cnt]: m) {
            if (cnt == 1) {
            ans = p[num] + 1;
            break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}
