1
3
5 3 4
 6
5
5 3 4 4 5
3
1 1 1
5
4 4 3 4 4
5
5 5 4 3 2
3
1 1 2
5
5 4 3 5 5
 1
3
10 1 5

1
 1
-1
2
2
3
1
 1

t = int(input())
for i in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    if max(a) == min(a):
        print(-1)
    else:
        a1 = a[:a.index(min(a))]
        a2 = a[a.index(min(a))+1:]
        a1.reverse()
        if max(a) in a1:
            ai1 = len(a1) - a1.index(max(a))
        else:
            ai1 = -1
        if max(a) in a2:
            ai2 = len(a1)+1+a2.index(max(a))+1
        else:
            ai2 = -1
        if ((ai1 < ai2) and (ai1 != -1)) or (ai2 == -1):
            print(ai1)
        else:
            print(ai2)