#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);cout<<setprecision(25);
#define pb push_back
typedef long long int ll;
ll M=1000000007;
using namespace std;
int main()
{
   IOS;
   ll T;
   cin>>T;
   while(T--)
   {
   	ll n,i;
   	cin>>n;
   	ll a[n];
   	vector<pair<ll,ll>>v;
   	for(i=0;i<n;i++)
	{
	   cin>>a[i];
	   v.pb({a[i],i+1});
    }
   	sort(v.begin(),v.end());
   	if(n==1)cout<<a[0]<<endl;
   	else
   	{
   	for(i=0;i<n;i++)
   	{
   		if(i==0)
   		{
   			if(v[i].first!=v[i+1].first)
   			{
   				cout<<v[i].second<<endl;
   				break;
			}
		}
		else if(i==n-1)
   		{
   			if(v[i-1].first!=v[i].first)
   			{
   				cout<<v[i].second<<endl;
   				break;
			}
		}
		else
		{
			if(v[i].first!=v[i+1].first&&v[i].first!=v[i-1].first)
   			{
   				cout<<v[i].second<<endl;
   				break;
			}
		}
	}
	if(i==n)cout<<-1<<endl;
    }
   }
}
