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

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"


  


signed main()
{
    IOS;
    int t=1;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n+1];
        map<int,int>mp;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            mp[a[i]]++;
        }
        int x=-1;
        for(auto i:mp)
        {
            if(i.second==1)
            {
                x=i.first;
                break;
            }
        }
        if(x==-1)
        {
            cout<<-1<<endl;
            continue;
        }
        else
        {
            for(int i=1;i<=n;i++)
            {
                if(a[i]==x)
                {
                    cout<<i<<endl;
                    break;
                }
            }
        }
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    }
	
	return 0;
}