I = lambda:int(input())
ID = lambda:map(int, input().split())
IL = lambda:list(ID())
T = I()
for _ in range(T):
	n = I()
	a = IL()
	b = []
	if n == 1 or a == list(range(1,n)) or a == list(range(n,1,-1)):
		print(-1)
	elif n == 2:
		if a[0] == a[1]:
			print(2)
		else:
			print(-1)
	elif n>2 and a.count(a[0])==n:
		print(2)
	else:
		for i in range(n):
			for j in range(n):
				if a[i] == a[j] and i!=j:
					b.append(j)
		b[:] = (i for i in b if i!=0 and i!=1)
		print(min(b)+1)