#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define REPP(i,l,r,c) for (int i=l;i<r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define REPS(i,l,r) REP(i,l,r+1)
#define FOR(i,n) REP(i,0,n)
#define REPD(i,l,r) for (int i=r-1;i>=l;i--)
#define FOD(i,n) REPD(i,0,n)
#define FOREACH(x,v) for (auto x:v)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

inline bool between(int x,int l,int r) {
	return l<=x&&x<=r;
}

map<int,pii> cnt;

inline void work() {
	int n; cin>>n; cnt.clear(); FOR(i,n) {
		int x; cin>>x; cnt[x].fi++; cnt[x].se=i;
	}
	FOREACH(data,cnt) {
		if (data.se.fi==1) {
			cout<<data.se.se+1<<endl; return;
		}
	}
	cout<<-1<<endl; return;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int kasus; cin>>kasus; while (kasus--) work();
	return 0;
}
