#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
void Fast(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
}
void File() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
}
typedef long long ll;
#define watch(x) cout << (#x) << " = " << x << '\n'
#define endl '\n'
#define all(a) a.begin(), a.end()
#define fix(n) cout << fixed << setprecision(n)
#define skip continue
const long double pi = acos(-1);
class vector2{
private:
float x , y;
};
int main()
{
Fast();
int t;cin >> t;
while(t--){
int n;cin >> n;
vector<int>v(n);
for(auto &it:v){
cin >> it;
}
sort(all(v));
int cnt = 0 , ans = 0;
for(int i = n -1 ; i >= 0;i--){
if(v[i] == v[n-1]){
cnt++;
ans = i;
}
}
if(cnt > 2){
cout << -1 << endl;
}
else{
cout << ans + 1 << endl;
}
}
}
Copy