from collections import Counter , deque
for s in [*open(0)][2::2]:
s = list(map(int,s.split()))
x = min(s)
arr = Counter(s)
lst = deque()
for key , value in arr.items():
if value == 1:
lst.append(key)
lst = sorted(lst)
if lst:
x = lst[0]
print(s.index(x)+1)
else:
print(-1)
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#define ll long long
#define pcl std::pair<char, long long>
#define IOS ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0)
#define endl "\n"
const int maxn=1e6;
int t,n, m;
void solve()
{
std::cin>>n;
std::map<int,int>num,pos;
for(int i=1;i<=n;i++){
int x;
std::cin>>x;
num[x]++;
pos[x]=i;
}
int ans=-1;
for(auto it:num){
if(it.second==1){
ans=pos[it.first];
break;
}
}
std::cout<<ans<<endl;
}
int main(){
std::IOS;
std::cin>>t;
while(t--)
{
solve();
}
return 0;
}
214A - System of Equations | 287A - IQ Test |
1108A - Two distinct points | 1064A - Make a triangle |
1245C - Constanze's Machine | 1005A - Tanya and Stairways |
1663F - In Every Generation | 1108B - Divisors of Two Integers |
1175A - From Hero to Zero | 1141A - Game 23 |
1401B - Ternary Sequence | 598A - Tricky Sum |
519A - A and B and Chess | 725B - Food on the Plane |
154B - Colliders | 127B - Canvas Frames |
107B - Basketball Team | 245A - System Administrator |
698A - Vacations | 1216B - Shooting |
368B - Sereja and Suffixes | 1665C - Tree Infection |
1665D - GCD Guess | 29A - Spit Problem |
1097B - Petr and a Combination Lock | 92A - Chips |
1665B - Array Cloning Technique | 1665A - GCD vs LCM |
118D - Caesar's Legions | 1598A - Computer Game |