/*
	Solution by:- 
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR
 
*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib> 
#include<cmath>
 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(pair<ll,ll> a,pair<ll,ll> b){
  return a.second<b.second;
}

int main(){
  cinll(t);
  while(t--){
    cinll(n);
    vector<ll> arr;
    unordered_map<ll,ll> mapit;
    vector<pair<ll,ll>> ans;
    for(ll i=0;i<n;i++) {
      cinll(x);
      arr.pb(x);
      mapit[x]++;
    }
    ll anss = -1;
    for(ll i=0;i<n;i++){
      if(mapit[arr[i]]==1) ans.pb(mp(i+1,arr[i]));
    }
    sort(ans.begin(),ans.end(),compare);
    if(ans.size()>=1) anss = ans[0].first;
    cout<<anss<<"\n";
  }
  return 0;
}
