#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e+5;
struct node
{
    int t, z;
} e[maxn];
bool cmp(node a,node b)
{
    return a.t < b.t;
}
int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        for (int i = 1; i <= n;i++)
        {
            cin >> e[i].t;
            e[i].z = i;
        }
        sort(e + 1, e + 1 + n,cmp);
        int f = 1;
        e[n + 1].t = 0;
        e[0].t = 0;
        for (int i = 1; i <= n;i++)
        {
            if(e[i].t!=e[i+1].t&&e[i].t!=e[i-1].t)
            {
                cout << e[i].z << endl;
                f = 0;
                break;
            }
        }
        if(f)
            cout << -1 << endl;
    }
    return 0;
}

