// keep learning

#include <bits/stdc++.h>
using namespace std;
#define     ll long long int
#define     pb push_back
#define     mk make_pair
#define     ub upper_bound
#define     lb lower_bound
#define     ff first
#define     ss second
#define     inf 1000000009
#define     mod 1000000007
#define     for0(i,a,n) for(ll i=a;i<=n;i++)
#define     all(c) c.begin(),c.end()
#define     debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define     fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     MAX 100
#define     pi 3.141592653589793238462643383279502884

typedef     vector <ll> vll;
typedef     vector <pair<ll, ll>> vp;
typedef     vector<vector<ll> >vvll;

void solve()
{
    ll n;
    cin >> n;
    ll a[n];
    map<ll, ll>m;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    ll x = INT_MAX;
    for (auto i : m)
    {
        if (i.second == 1)
        {
            x = min(x, i.first);
        }
    }
    if (x == INT_MAX)
        cout << -1 << endl;
    else
    {
        for (ll i = 0; i < n; i++)
        {
            if (a[i] == x)
            {
                cout << i + 1 << endl;
                return;
            }
        }
    }

}
int main()
{
    clock_t zzzz = clock();
    fio;
    ll t;
    t = 1;
    cin >> t;
    while (t--)
        solve();
    debug("Total Time: %.3f\n", (double)(clock() - zzzz) / CLOCKS_PER_SEC);
}