from math import *
x3=[]
n =0
x = int(input())
for i in range (x):
x5=0
x2 = int(input())
x3=list (map(int,input().split()))
x4 =tuple( x3)
x3.sort()
x3.reverse()
x6= x4.index(x3[0])
if x6 == 0:
for i2 in range(len(x3)-1):
if int(x4[i2]) == int(x4[i2+1]):
x6=x6+1
else :
break
for i1 in range (len(x3)-1):
if x3[i1] > x3[i1+1] :
x5=x5+1
if x5>0: print (x6+1)
else :print(-1)
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define debug(x) cerr << getVName(x) <<" = " << x << '\n';
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define bit(mask, i) (((mask)>>(i))&1)
#define F first
#define S second
using namespace std;
int mod = 1e9 + 7;
const int N = 2e5 + 9;
ll inf = 1e18 + 7;
double PI = acos(-1);
double EPS = 1e-9;
bool valid(ll x){
ll s=0,y=x;;
while(x){
s+=x%10;
x/=10;
}
return __gcd(y,s)>1;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int>a(n+2,mod);
int mx=0;
for(int i=1;i<=n;i++){
cin>>a[i];;
mx=max(mx,a[i]);
}
int ans=-1;
for(int i=1;i<=n;i++){
if(a[i]==mx&&(a[i]>a[i-1]||a[i]>a[i+1])){
ans=i;
}
}
cout<<ans<<"\n";
}
return 0;
}
74. Search a 2D Matrix | 71. Simplify Path |
62. Unique Paths | 50. Pow(x, n) |
43. Multiply Strings | 34. Find First and Last Position of Element in Sorted Array |
33. Search in Rotated Sorted Array | 17. Letter Combinations of a Phone Number |
5. Longest Palindromic Substring | 3. Longest Substring Without Repeating Characters |
1312. Minimum Insertion Steps to Make a String Palindrome | 1092. Shortest Common Supersequence |
1044. Longest Duplicate Substring | 1032. Stream of Characters |
987. Vertical Order Traversal of a Binary Tree | 952. Largest Component Size by Common Factor |
212. Word Search II | 174. Dungeon Game |
127. Word Ladder | 123. Best Time to Buy and Sell Stock III |
85. Maximal Rectangle | 84. Largest Rectangle in Histogram |
60. Permutation Sequence | 42. Trapping Rain Water |
32. Longest Valid Parentheses | Cutting a material |
Bubble Sort | Number of triangles |
AND path in a binary tree | Factorial equations |