There is a game called "Unique Bid Auction". You can read more about it here:

https://en.wikipedia.org/wiki/Unique_bid_auction

(though you don't have to do it to solve this problem).

Let's simplify this game a bit. Formally, there are $n$ participants, the $i$-th participant chose the number $a_i$. The winner of the game is such a participant that the number he chose is unique (i. e. nobody else chose this number except him) and is minimal (i. e. among all unique values of $a$ the minimum one is the winning one).

Your task is to find the index of the participant who won the game (or -1 if there is no winner). Indexing is $1$-based, i. e. the participants are numbered from $1$ to $n$.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 2 \cdot 10^4$) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of participants. The second line of the test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le n$), where $a_i$ is the $i$-th participant chosen number.

It is guaranteed that the sum of $n$ does not exceed $2 \cdot 10^5$ ($\sum n \le 2 \cdot 10^5$).


-----Output-----

For each test case, print the answer — the index of the participant who won the game (or -1 if there is no winner). Note that the answer is always unique.


-----Examples-----

Input
6
2
1 1
3
2 1 3
4
2 2 2 3
1
1
5
2 3 2 4 2
6
1 1 5 5 4 4
Output
-1
2
4
1
2
-1


-----Note-----

None

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	n += 5
	ark = [0] * n
	s = -1
	for j in arr:
		ark[j] += 1
	for i in range(1, n):
		if ark[i] == 1:
			s = arr.index(i) + 1
			break
	print(s)


n = int(input())
for _ in range(n):
	c = int(input())
	nums = list(map(int, input().split()))
	numSet = set()
	removeSet = set()
	for num in nums:
		if num not in numSet:
			if num not in removeSet:
				numSet.add(num)
		else:
			numSet.remove(num)
			removeSet.add(num)
	if numSet:
		minNum = min(numSet)
		for i in range(len(nums)):
			if nums[i] == minNum:
				print(i + 1)
				break
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {i: 0 for i in a}
	for i in a:
		if i not in d:
			d[i] = 1
		d[i] += 1
	x = int(1000000000.0)
	for (i, j) in zip(d.keys(), d.values()):
		if j == 1:
			if i < x:
				x = i
	if x == int(1000000000.0):
		print(-1)
	else:
		print(a.index(x) + 1)


t = int(input())
for i in range(t):
	d = dict()
	l = int(input())
	ans = []
	arr = list(map(int, input().split()))
	for num in arr:
		if num in d:
			d[num] += 1
		else:
			d[num] = 1
	for (key, value) in d.items():
		if value == 1:
			ans.append(key)
	if len(ans) == 0:
		print('-1')
	else:
		print(arr.index(min(ans)) + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [0] * n
	for i in a:
		c[i - 1] = c[i - 1] + 1
	print(a.index(c.index(1) + 1) + 1) if 1 in c else print(-1)


from sys import stdin

def get_winner(lista, contador):
	for p in lista:
		if contador[p] == 1:
			return p
	return -1
t = int(stdin.readline())
for _ in range(t):
	_ = stdin.readline()
	lista = list(map(int, stdin.readline().split()))
	contador = {}
	i = 0
	for el in lista:
		if el not in contador:
			contador[el] = 0
		contador[el] += 1
	participantes = sorted(contador.keys())
	winner = get_winner(participantes, contador)
	if winner > -1:
		winner = lista.index(winner) + 1
	print(winner)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	a = [None] * (n + 1)
	i = 1
	for v in mints():
		if a[v] is None:
			a[v] = i
		else:
			a[v] = -1
		i += 1
	for i in a:
		if i is not None and i != -1:
			print(i)
			return
	print(-1)
for i in range(mint()):
	solve()


from collections import Counter
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	l = list(map(int, input().split()))
	c = Counter(l)
	try:
		print(l.index(min((v for (v, n) in c.items() if n == 1))) + 1)
	except:
		print('-1')


for i in range(int(input())):
	n = int(input())
	drr = [0] * (n + 1)
	arr = list(map(int, input().split()))
	for i in arr:
		drr[i] += 1
	for i in range(1, n + 1):
		if drr[i] == 1:
			print(arr.index(i) + 1)
			break
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	process = data.copy()
	process.sort()
	if n == 1:
		print(data.index(process[0]) + 1)
		continue
	elif process[0] != process[1]:
		print(data.index(process[0]) + 1)
		continue
	elif n == 2 and process[0] == process[1]:
		print('-1')
	else:
		flag = True
		for j in range(n)[1:-1]:
			if process[j - 1] != process[j] and process[j] != process[j + 1]:
				print(data.index(process[j]) + 1)
				flag = False
				break
		if flag and process[n - 1] != process[n - 2]:
			print(data.index(process[n - 1]) + 1)
		elif flag:
			print('-1')


import collections
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = collections.OrderedDict()
	for ele in l:
		c[ele] = c.get(ele, 0) + 1
	ans = 0
	vv = 10000000000
	for (k, v) in c.items():
		if v == 1:
			ans = k
			vv = min(k, vv)
	if ans == 0:
		print(-1)
	else:
		print(l.index(vv) + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	values = list(map(int, input().split()))
	indeces = [0 for _ in range(len(values) + 1)]
	counts = [0 for _ in range(len(values) + 1)]
	ans = -1
	for i in range(len(values)):
		v = values[i]
		counts[v] += 1
		indeces[v] = i + 1
	for i in range(len(counts)):
		if counts[i] == 1:
			ans = indeces[i]
			break
	print(ans)


from sys import stdin
input = stdin.readline
t = int(input())
res = []
for i in range(t):
	n = int(input())
	nums = [int(x) for x in input().split()]
	count = {}
	for n in nums:
		count[n] = count.get(n, 0) + 1
	uniques = []
	for i in range(len(nums)):
		if count[nums[i]] == 1:
			uniques.append((i + 1, nums[i]))
	if uniques:
		uniques.sort(key=lambda tup: tup[1])
		res.append(uniques[0][0])
	else:
		res.append(-1)
for e in res:
	print(e)


from functools import reduce
import os
import sys
from collections import *
from decimal import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
div = 998244353
for _ in range(inn()):
	n = inn()
	a = arr()
	d = defaultdict(list)
	mn = inf
	ans = -1
	for i in range(n):
		d[a[i]] += [i + 1]
	for i in d:
		if len(d[i]) == 1 and i < mn:
			mn = i
			ans = d[i][0]
	print(ans)


t = int(input())
from collections import Counter
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	uniqd = dict()
	for (j, el) in enumerate(arr):
		if el in uniqd:
			uniqd[el] = n + 1
		else:
			uniqd[el] = j + 1
	data = [(i[0], i[1]) for i in uniqd.items() if i[1] < n + 1]
	if len(data) > 0:
		print(sorted(data)[0][1])
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	q = list(map(int, input().split()))
	nq = [0] * (n + 1)
	for i in q:
		nq[i] += 1
	for c in range(1, n + 1):
		if nq[c] == 1:
			print(q.index(c) + 1)
			break
	else:
		print(-1)


for i in range(int(input())):
	lenn = int(input())
	list1 = list(map(int, input().split()))
	s = sorted(list1)
	if lenn == 1:
		print(1)
	elif s[0] != s[1]:
		print(list1.index(s[0]) + 1)
	elif lenn == 2:
		print(-1)
	else:
		output = 'ok'
		for i in range(1, lenn - 1):
			if s[i - 1] != s[i] != s[i + 1]:
				output = list1.index(s[i]) + 1
				break
		if output == 'ok':
			if s[-1] != s[-2]:
				print(list1.index(s[-1]) + 1)
			else:
				print(-1)
		else:
			print(output)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	answer = [0] * (n + 1)
	for i in a:
		answer[i] += 1
	if answer.count(1) == 0:
		print(-1)
	else:
		print(a.index(answer.index(1)) + 1)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	a = inl()
	count = dict()
	for i in a:
		if i not in count:
			count[i] = 0
		count[i] += 1
	b = sorted(filter(lambda x: x[1] == 1, count.items()), key=lambda x: x[0])
	if b:
		print(a.index(b[0][0]) + 1)
	else:
		print(-1)


import bisect
import collections as col
import functools as ft
import heapq
import itertools as it
import math
import os
import sys
sys.setrecursionlimit(10 ** 9)
readline = sys.stdin.readline

def I():
	return int(readline().strip())

def S():
	return [x for x in readline().strip()]

def IL():
	return list(map(int, readline().split()))

def SL():
	return list(map(str, readline().split()))

def ILs(n):
	return list((int(readline()) for _ in range(n)))

def SLs(n):
	return list((readline().strip() for _ in range(n)))

def ILL(n):
	return [list(map(int, readline().split())) for _ in range(n)]

def SLL(n):
	return [list(map(str, readline().split())) for _ in range(n)]
MOD = 10 ** 9 + 7
INF = float('inf')

def main():
	for _ in range(I()):
		n = I()
		a = IL()
		ans = []
		counts = col.Counter(a)
		unique = [k for (k, v) in counts.items() if v == 1]
		if unique:
			idx = a.index(min(unique)) + 1
			print(idx)
		else:
			print(-1)
main()


def read_data():
	t = int(input())
	data = []
	for _ in range(t):
		n = int(input().strip())
		d = input().split()
		d = list(map(int, d))
		data.append(d)
	return data

def answer(data):
	for row in data:
		dictionary = {}
		for answer in row:
			if answer in dictionary:
				dictionary[answer] += 1
			else:
				dictionary[answer] = 1
		min_number = 10000000
		for key in dictionary:
			if dictionary[key] == 1:
				if key < min_number:
					min_number = key
		if min_number != 10000000:
			print(row.index(min_number) + 1)
		else:
			print(-1)

def main():
	data = read_data()
	answer(data)
main()


from collections import defaultdict

def func(n, arr):
	d = defaultdict(int)
	for i in arr:
		d[i] += 1
	s = list(d.keys())
	s.sort()
	for i in s:
		if d[i] == 1:
			print(arr.index(i) + 1)
			return
	print(-1)
	return
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	func(n, arr)


for _ in range(0, int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	br = sorted(ar)
	dic = {}
	for i in br:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	for i in dic:
		if dic[i] == 1:
			print(ar.index(i) + 1)
			break
	else:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	s1 = list(map(int, input().split()))
	f = {}
	for i in s1:
		if i in f:
			f[i] += 1
		else:
			f[i] = 1
	uni = []
	for (key, value) in f.items():
		if value == 1:
			uni.append(key)
	if len(uni) == 0:
		print(-1)
	else:
		print(s1.index(min(uni)) + 1)


from sys import stdin, exit, setrecursionlimit
setrecursionlimit(100000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	a = lmi()
	bad = set()
	s = set()
	for i in a:
		if i in s:
			bad.add(i)
		s.add(i)
	ans = float('inf')
	fin = 0
	for (idx, i) in enumerate(a):
		if i not in bad:
			if ans > i:
				fin = idx + 1
			ans = min(ans, i)
	print(fin if ans != float('inf') else -1)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = list(set(a))
	s.sort()
	ans = -1
	d = Counter(a)
	for i in range(len(s)):
		if d[s[i]] == 1:
			ans = a.index(s[i]) + 1
			break
	print(ans)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	dic = {}
	for i in arr:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	flag = 0
	for i in dic.keys():
		if dic[i] == 1:
			flag = 1
			break
	if flag == 0:
		print(-1)
	else:
		p = []
		for i in dic.keys():
			if dic[i] == 1:
				p.append(i)
		p.sort()
		k = p[0]
		for i in range(0, n):
			if k == arr[i]:
				print(i + 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	num = [0] * (n + 1)
	for i in a:
		num[i] += 1
	if num.count(1) == 0:
		print(-1)
	else:
		print(a.index(num.index(1)) + 1)


def solve(n, nums):
	hash = {}
	for num in nums:
		if num not in hash:
			hash[num] = 0
		hash[num] += 1
	ans = -1
	for i in range(n):
		if hash[nums[i]] == 1:
			if ans == -1:
				ans = i
			elif nums[i] < nums[ans]:
				ans = i
	return ans + 1 if ans != -1 else ans
t = int(input())
while t:
	n = int(input())
	nums = list(map(int, input().split()))
	print(solve(n, nums))
	t -= 1


ans = []
for _ in range(int(input())):
	n = int(input())
	arr = [*map(int, input().split())]
	cnt = [float('inf')] * (n + 1)
	if n > 1 and len(set(arr)) == 1:
		ans.append(-1)
		continue
	for i in range(n):
		if cnt[arr[i]] == float('inf'):
			cnt[arr[i]] = 1
		else:
			cnt[arr[i]] += 1
	key = min(cnt)
	if key > 1:
		ans.append(-1)
		continue
	ans.append(arr.index(cnt.index(key)) + 1)
print('\n'.join(map(str, ans)))


t = int(input())

def uniq_bid_auction(n, a):
	min = 100000000000000000000
	similar = [0] * (n + 1)
	for i in a:
		similar[i] += 1
	for i in a:
		if i < min and similar[i] == 1:
			min = i
	if min == 100000000000000000000:
		return -1
	else:
		return a.index(min) + 1
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(uniq_bid_auction(n, a))


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = []
	l = a.copy()
	l.sort()
	ae = l[0]
	found = False
	ans = -1
	if n == 1:
		print(1)
		continue
	if l[0] != l[1]:
		print(a.index(l[0]) + 1)
		continue
	for i in range(1, n):
		if l[i] != l[i - 1]:
			if i + 1 < n:
				if l[i] != l[i + 1]:
					ae = l[i]
					found = True
					break
			if i == n - 1:
				ae = l[i]
				found = True
	if found:
		print(a.index(ae) + 1)
	else:
		print(-1)


def main():
	n = int(input())
	counter = dict()
	numbers = map(int, input().split())
	for (i, elem) in enumerate(numbers):
		if elem not in counter:
			counter[elem] = i + 1
		else:
			counter[elem] = None
	result = sorted([(x, i) for (x, i) in counter.items() if i is not None], key=lambda x: x[0])
	if result:
		print(result[0][1])
	else:
		print(-1)
for _ in range(int(input())):
	main()


import sys
infile = sys.stdin
next(infile)
for l in infile:
	n = int(l)
	a = list(map(int, infile.readline().split()))
	b = a[:]
	a.sort()
	i = 1
	c = 0
	if n == 1:
		print(1)
	elif n == 2:
		if a[0] != a[1]:
			print(1)
		else:
			print(-1)
	else:
		if a[0] != a[1]:
			k = a[0]
		else:
			while i < n - 1:
				if a[i] != a[i - 1] and a[i] != a[i + 1]:
					c = 1
					k = a[i]
					break
				else:
					i += 1
			if c == 0:
				if a[n - 2] != a[n - 1]:
					k = a[n - 1]
				else:
					k = -1
		if k != -1:
			for i in range(n):
				if b[i] == k:
					print(i + 1)
		else:
			print(k)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = [0] * n
	for i in l:
		s[i - 1] += 1
	if 1 in s:
		print(l.index(s.index(1) + 1) + 1)
	else:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	data = list(map(int, input().split()))
	base = [0] * n
	for x in data:
		base[x - 1] = base[x - 1] + 1
	if 1 in base:
		print(data.index(base.index(1) + 1) + 1)
	else:
		print(-1)


from sys import stdin
_input = stdin.readline
(_sorted, _int, _range, _list, _min) = (sorted, int, range, list, min)
from collections import Counter

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = [_int(i) for i in _input().split()]
		d = Counter(arr)
		min_value = 10 ** 6
		for i in _sorted(_list(d.keys()), reverse=True):
			if d[i] == 1:
				min_value = i
		if min_value == 10 ** 6:
			print(-1)
		else:
			for i in _range(n):
				if arr[i] == min_value:
					print(i + 1)
					break
solution()


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted(enumerate(list(map(int, stdin.readline().split()))), key=lambda x: x[1])
	res = -1
	if n == 1:
		res = a[0][0] + 1
	else:
		for i in range(1, n - 1):
			if a[i][1] != a[i + 1][1] and a[i][1] != a[i - 1][1]:
				res = a[i][0] + 1
				break
		if a[0][1] != a[1][1]:
			res = a[0][0] + 1
		if res == -1 and a[-2][1] != a[-1][1]:
			res = a[-1][0] + 1
	print(res)


t = int(input())
answers = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = a.copy()
	b.sort()
	if n == 1:
		min = 1
	elif b[0] != b[1]:
		min = a.index(b[0]) + 1
	else:
		min = -1
		if n > 2:
			for i in range(2, n - 1):
				if b[i - 1] != b[i] != b[i + 1]:
					min = a.index(b[i]) + 1
					break
			else:
				if b[n - 1] != b[n - 2]:
					min = a.index(b[n - 1]) + 1
	answers.append(min)
for answer in answers:
	print(answer)


import sys

def getUniqueBid(bids):
	bid_counts = {}
	for i in bids:
		if i not in bid_counts.keys():
			bid_counts[i] = 1
		else:
			bid_counts[i] = bid_counts[i] + 1
	inverted_counts = {}
	for (k, v) in bid_counts.items():
		if v not in inverted_counts.keys():
			inverted_counts[v] = [k]
		else:
			inverted_counts[v].append(k)
	if 1 not in inverted_counts.keys():
		return -1
	unique_bids = inverted_counts[1]
	min_unique_bids = unique_bids[0]
	for bid in unique_bids:
		if bid < min_unique_bids:
			min_unique_bids = bid
	return bids.index(min_unique_bids) + 1
testcase_flag = True
count = 0
testCaseCount = 0
costs = []
for line in sys.stdin:
	inputs = [x for x in line.strip().split()]
	if testcase_flag:
		testCaseCount = int(inputs[0])
		testcase_flag = False
		continue
	if count % 2 == 0:
		n = int(inputs[0])
		count = count + 1
		continue
	if count % 2 == 1:
		bids = []
		for i in range(n):
			bids.append(int(inputs[i]))
		count = count + 1
		cost = getUniqueBid(bids)
		costs.append(cost)
		if count == testCaseCount * 2:
			break
for i in range(testCaseCount):
	print(costs[i])


from collections import defaultdict
t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = -1
	bi = -1
	d = defaultdict(lambda : 0)
	for i in range(n):
		d[a[i]] += 1
	for i in range(n):
		if d[a[i]] == 1:
			if b == -1 or a[i] < b:
				b = a[i]
				bi = i + 1
	if b == -1:
		print(-1)
	else:
		print(bi)


x = int(input())
for i in range(x):
	y = int(input())
	l = list(map(int, input().split()))
	m = sorted(l)
	s = 0
	if y == 1:
		print('1')
	elif m[0] != m[1]:
		print(l.index(m[0]) + 1)
	else:
		for j in range(1, y - 1):
			if m[j] != m[j - 1] and m[j] != m[j + 1]:
				print(l.index(m[j]) + 1)
				s += 1
				break
		if s == 0 and m[-1] != m[-2]:
			print(l.index(m[-1]) + 1)
		elif s == 0:
			print('-1')


input = __import__('sys').stdin.readline
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p = Counter(a)
	ind = 10 ** 24
	for i in p:
		if p[i] == 1:
			ind = min(ind, i)
	if ind == 10 ** 24:
		print(-1)
	else:
		for i in range(n):
			if a[i] == ind:
				print(i + 1)
				break


tests = []
for _ in range(int(input())):
	n = int(input())
	tests.append(list(map(int, input().split())))
for test in tests:
	d = dict()
	ans = []
	for i in test:
		d[i] = d.get(i, 0) + 1
	for (i, j) in d.items():
		if j == 1:
			ans.append(i)
	print(test.index(min(ans)) + 1 if ans else -1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		d[i] = d.get(i, 0) + 1
	u = 999999999
	f = 1
	for i in d:
		if d[i] == 1 and i <= u:
			f = 0
			u = i
	if f == 1:
		print('-1')
	else:
		print(l.index(u) + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = {}
	for x in a:
		c[x] = c.get(x, 0) + 1
	b = [x for x in c if c[x] == 1]
	if b:
		x = min(b)
		print(a.index(x) + 1)
	else:
		print(-1)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f = defaultdict(int)
	for i in l:
		f[i] += 1
	(mini, chk) = (1000000, -1)
	for i in range(n - 1, -1, -1):
		if f[l[i]] == 1:
			if l[i] < mini:
				(mini, chk) = (l[i], i + 1)
	print(chk)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	B = [0] * n + [1]
	C = [0] * n
	index = 0
	while index < n:
		B[a[index] - 1] += 1
		C[a[index] - 1] = index
		index += 1
	J = B.index(1)
	if J == n:
		print(-1)
	else:
		print(C[J] + 1)


import sys
input = sys.stdin.readline
inputLines = sys.stdin.readlines

def readIntList():
	return list(map(int, input().split()))

def readStrList():
	return list(map(lambda x: x.strip(), inputLines()))

def indexOf(l: list, elem: int):
	return l.index(elem) if elem in l else -1

def lastIndexOf(l: list, elem: int):
	indexes = [idx for (idx, val) in enumerate(l) if val == elem]
	return max(indexes) if len(indexes) > 0 else -1

def solution():
	for _ in range(int(input())):
		n = int(input())
		l = readIntList()
		freq = {}
		winner = -1
		for i in range(n):
			freq[l[i]] = freq[l[i]] + 1 if l[i] in freq else 1
		for i in range(n):
			if freq[l[i]] == 1 and (winner < 0 or l[i] < l[winner]):
				winner = i
		print(winner + 1 if winner >= 0 else winner)
solution()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = [0] * (n + 1)
	for j in range(n):
		l1[l[j]] += 1
	ans = 0
	for j in range(1, n + 1):
		if l1[j] == 1:
			ans = 1
			num = l.index(j)
			break
	if ans == 0:
		print(-1)
	else:
		print(num + 1)


import sys
import os
import math
import copy
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations, accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def watch(x):
	return print(x)

def common(l1, l2):
	return set(l1).intersection(l2)

def Most_frequent(list):
	return max(set(list), key=list.count)

def solution():
	for _ in range(Int()):
		n = Int()
		a = List()
		b = Counter(a)
		m = sys.maxsize
		ans = -1
		for i in range(n):
			if b[a[i]] == 1 and m > a[i]:
				m = a[i]
				ans = i + 1
		print(ans)
solution()


for s in [*open(0)][2::2]:
	d = {}
	i = 0
	for x in map(int, s.split()):
		i += 1
		d[x] = (i, -1)[x in d]
	print(min([(x, d[x]) for x in d if d[x] > 0] + [(300000.0, -1)])[1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = dict()
	for j in l:
		d[j] = d.get(j, 0) + 1
	mn = -1
	for j in d:
		if d[j] == 1 and (mn == -1 or j < mn):
			mn = j
	if mn == -1:
		print(-1)
	else:
		print(l.index(mn) + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	arr = [0] * (n + 1)
	for i in a:
		arr[i] += 1
	for i in range(n + 1):
		if arr[i] == 1:
			print(a.index(i) + 1)
			break
	if arr.count(1) == 0:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = [0] * (n + 1)
	idx = [0] * (n + 1)
	for (i, x) in enumerate(map(int, input().split())):
		cnt[x] += 1
		idx[x] = i + 1
	ans = -1
	for (cn, id) in zip(cnt, idx):
		if cn == 1:
			ans = id
			break
	print(ans)


Q = int(input())
for i in range(Q):
	N = int(input())
	L = list(map(int, input().split()))
	D = {}
	for j in L:
		if j not in D:
			D[j] = 1
		else:
			D[j] += 1
	Min = 10 ** 9
	Flag = -1
	for i in range(len(L)):
		if D[L[i]] == 1 and Min > L[i]:
			Flag = i + 1
			Min = L[i]
	print(Flag)


n = int(input())
num = list()
array = list()
for j in range(n):
	num.append(int(input()))
	array.append(list(map(int, input().split())))
for j in range(n):
	ans = list()
	new = array[j]
	c = [0] * len(new)
	for x in new:
		c[x - 1] += 1
	if 1 in c:
		print(new.index(c.index(1) + 1) + 1)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	temp = []
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = 1
		else:
			d[a[i]] += 1
	temp = 10000000000
	if 1 not in d.values():
		print(-1)
	else:
		for i in d:
			if d[i] == 1:
				if temp > i:
					temp = i
		print(a.index(temp) + 1)


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	temparr = input()
	if n == 1:
		print(1)
		continue
	temparr = temparr.split()
	arr = []
	for i in temparr:
		arr.append(int(i))
	uniqarr = []
	dicts = {}
	for i in arr:
		if i not in dicts:
			dicts[i] = 1
		else:
			dicts[i] += 1
	for (key, value) in dicts.items():
		if value == 1:
			uniqarr.append(key)
	if len(uniqarr) == 0:
		print(-1)
		continue
	uniqarr = sorted(uniqarr)
	mins = uniqarr[0]
	for (i, j) in enumerate(arr):
		if j == mins:
			print(i + 1)
			break


import os
import sys
from io import BytesIO, IOBase
MOD1 = 1000000007
MOD2 = 998244353
import math
from collections import defaultdict

def solution():
	d = defaultdict(int)
	n = int(input())
	a = list(map(int, input().split()))
	for i in a:
		d[i] += 1
	minsofar = math.inf
	for i in d:
		if d[i] == 1:
			minsofar = min(minsofar, i)
	if minsofar != math.inf:
		print(a.index(minsofar) + 1)
	else:
		print(-1)
	return

def main():
	testcases = 1
	testcases = int(input())
	for _ in range(testcases):
		solution()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	n = int(input())
	dic = {}
	x = list(map(int, input().split()))
	for j in range(1, len(x) + 1):
		dic.setdefault(x[j - 1], [0, j])
		dic[x[j - 1]][0] += 1
	k = -1
	min = float('inf')
	z = 0
	for (q, w) in dic.items():
		if w[0] == 1:
			if min > q:
				min = q
				z = w[1]
				k = 0
	if k == -1:
		print(-1)
	else:
		print(z)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter

def main():
	for _ in range(int(input())):
		n = int(input())
		b = list(map(int, input().split()))
		a = sorted(b)
		c = Counter(a)
		for (key, val) in c.items():
			if val == 1:
				print(b.index(key) + 1)
				break
		else:
			print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def f(n, lst):
	l1 = sorted(lst)
	i = 0
	if n == 1:
		return 1
	elif n == 2:
		if l1[0] != l1[1]:
			return lst.index(l1[0]) + 1
	for i in range(n - 1):
		if l1[i] != l1[i + 1] and l1[i] != l1[i - 1]:
			return lst.index(l1[i]) + 1
		i += 1
	if l1[-1] == l1[-2]:
		return -1
	else:
		return lst.index(l1[-1]) + 1
	return -1
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(f(n, lst))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = Counter(a)
	try:
		print(a.index(min((i for i in c if c[i] == 1))) + 1)
	except:
		print(-1)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	m = float('inf')
	l = list(map(int, input().split()))
	c = Counter(l)
	ans = float('inf')
	for k in c:
		if c[k] > 1:
			pass
		elif m > c[k] and ans > k:
			m = k
			ans = k
	if ans == float('inf'):
		print(-1)
	else:
		print(l.index(ans) + 1)


tc = int(input())
for j in range(tc):
	x = int(input())
	y = list(map(int, input().split()))
	z = y.copy()
	z.sort()
	if x == 1:
		print(1)
		continue
	if z[0] != z[1]:
		print(y.index(z[0]) + 1)
		continue
	a = 0
	for i in range(1, x - 1):
		if z[i - 1] != z[i] != z[i + 1]:
			print(y.index(z[i]) + 1)
			a = 1
			break
	if a == 1:
		continue
	if z[x - 1] != z[x - 2]:
		print(y.index(z[x - 1]) + 1)
		continue
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	mn = n
	arr2 = [0] * (n + 1)
	ind = [n + 1] * (n + 1)
	for i in range(len(arr)):
		arr2[arr[i]] += 1
		if ind[arr[i]] > i:
			ind[arr[i]] = i
	b = False
	for i in range(len(arr2)):
		if arr2[i] == 1:
			print(ind[i] + 1)
			b = True
			break
	if not b:
		print(-1)


for s in [*open(0)][2::2]:
	d = {}
	i = 0
	for x in map(int, s.split()):
		i += 1
		v = d.get(x, 0)
		d[x] = (i, -1)[d.get(x, 0) != 0]
	a = [(x, d[x]) for x in d if d[x] > 0]
	print(a and min(a)[1] or -1)


for _ in range(int(input())):
	n = int(input())
	num = [0 for i in range(n + 3)]
	a = [int(val) for val in input().split()]
	for val in a:
		num[val] += 1
	ok = False
	for i in range(n + 1):
		if num[i] == 1:
			print(a.index(i) + 1)
			ok = True
			break
	if not ok:
		print('-1')


from sys import stdin, stdout
t = int(stdin.readline())
for q in range(t):
	k = int(stdin.readline())
	nums = [int(x) for x in stdin.readline().split(' ')]
	freq = dict()
	for i in nums:
		freq[i] = 0
	for i in nums:
		freq[i] += 1
	freqList = [(x, y) for (x, y) in freq.items()]
	freqList.sort(key=lambda x: x[0])
	for (idx, i) in enumerate(freqList):
		if i[1] == 1:
			print(nums.index(i[0]) + 1)
			break
		if idx == len(freqList) - 1:
			print(-1)


def bid(arr):
	if len(arr) == 0:
		return
	dic = {}
	for i in range(0, len(arr)):
		if arr[i] not in dic:
			dic[arr[i]] = [1, i + 1]
		elif arr[i] in dic:
			dic[arr[i]][0] = dic[arr[i]][0] + 1
	var = -1
	for i in dic:
		if var == -1 and dic[i][0] < 2:
			var = i
		elif var != -1 and var > i and (dic[i][0] < 2):
			var = i
	if var == -1:
		return var
	else:
		return dic[var][1]
test = int(input())
arr1 = []
for i in range(0, test):
	k = int(input())
	arr2 = [int(x) for x in input().split()]
	arr1.append(arr2)
for i in range(0, test):
	print(bid(arr1[i]))


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	ls = get_list()
	rev_map = defaultdict(int)
	for (i, v) in enumerate(ls, 1):
		rev_map[v] = i
	dic = Counter(ls)
	temp = []
	for (key, val) in dic.items():
		if val == 1:
			temp.append(key)
	temp.sort()
	if len(temp) > 0:
		print(rev_map[temp[0]])
	else:
		print('-1')
testcases = True
if testcases:
	t = get_int()
	for _ in range(t):
		solve()
else:
	solve()


import math
for _ in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	freq1 = {}
	l = []
	for i in list1:
		if i in freq1:
			freq1[i] += 1
		else:
			freq1[i] = 1
	for j in freq1:
		if freq1[j] == 1:
			l.append(j)
	if len(l) == 0:
		print(-1)
	else:
		l.sort()
		print(list1.index(l[0]) + 1)


def f(n):
	l = list(map(int, input().split()))
	d = {}
	for i in sorted(l):
		d[i] = d.get(i, 0) + 1
	for (i, j) in sorted(d.items()):
		if j == 1:
			return l.index(i) + 1
	return -1
for _ in range(int(input())):
	print(f(int(input())))


import sys
import heapq
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = {}
	for i in range(n):
		if arr[i] not in res:
			res[arr[i]] = 1
		else:
			res[arr[i]] += 1
	tmp = []
	for i in res:
		if res[i] == 1:
			tmp.append(i)
	tmp.sort()
	if len(tmp) == 0:
		print(-1)
	else:
		k = arr.index(tmp[0])
		print(k + 1)


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = dc(int)
	m = sys.maxsize
	p = -1
	for i in range(n):
		x[l[i]] += 1
	for i in x:
		if x[i] == 1:
			m = min(m, i)
	if m == sys.maxsize:
		print(-1)
	else:
		print(l.index(m) + 1)


t = int(input())
for T in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	d = dict()
	for i in range(1, n + 1):
		d[i] = 0
	for o in c:
		d[o] += 1
	m = n + 1
	for o in d:
		if o < m and d[o] == 1:
			m = o
	if m < n + 1:
		print(c.index(m) + 1)
	else:
		print(-1)


import math
import os
import random
import re
import string
from sys import *
from collections import *

def bs(arr, x, l, r):
	if l <= r:
		mid = (r + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return bs(arr, x, l, mid - 1)
		else:
			return bs(arr, x, mid + 1, r)
	else:
		return -1

def solve():
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, stdin.readline().strip().split()))
		d = dict(Counter(l))
		mi = 999999999999
		f = 1
		for i in d:
			if d[i] == 1:
				mi = min(mi, i)
		if mi == 999999999999:
			print(-1)
		else:
			print(l.index(mi) + 1)
solve()


def solve():
	n = int(input())
	chosen_numbers = list(map(int, input().split()))
	d = dict()
	for (index, c) in enumerate(chosen_numbers):
		if c in d:
			d[c].append(1 + index)
		else:
			d[c] = [1 + index]
	keys = list(d.keys())
	keys.sort()
	for k in keys:
		if len(d[k]) == 1:
			return d[k][0]
	return -1
for _ in range(int(input())):
	print(solve())


n = int(input())
array = []
for line in range(n):
	input()
	x = [*map(int, input().split())]
	m = {}
	for i in x:
		m[i] = m.get(i, 0) + 1
	m = sorted([[i, j + 1] for (j, i) in enumerate(x) if m[i] == 1])[:1] + [[-1, -1]]
	array += [m[0][1]]
for i in array:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	(*a,) = map(int, input().split())
	f = {}
	for i in range(n):
		if a[i] in f:
			f[a[i]] = -1
		else:
			f[a[i]] = i + 1
	m = -1
	for i in f:
		if f[i] != -1 and (i < m or m == -1):
			m = i
	print(f[m] if m != -1 else -1)


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
for _ in range(II()):
	n = II()
	s = {i: [] for i in range(1, n + 1)}
	for (i, v) in enumerate(MI(), 1):
		s[v].append(i)
	ok = 0
	for i in range(1, n + 1):
		if len(s[i]) == 1:
			print(s[i][0])
			ok = 1
			break
	if not ok:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	value = {}
	for i in range(n):
		if arr[i] not in value:
			value[arr[i]] = 1
		else:
			value[arr[i]] += 1
	nice = sorted(value.keys())
	lowest = 0
	for key in nice:
		if value[key] > 1:
			continue
		else:
			lowest = key
			break
	if lowest == 0:
		print(-1)
	else:
		ans = 0
		for i in range(n):
			if arr[i] == lowest:
				ans = i + 1
				break
		print(ans)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	counts = [0] * n
	for ai in a:
		counts[ai - 1] += 1
	found = False
	for i in range(n):
		if counts[i] == 1:
			print(a.index(i + 1) + 1)
			found = True
			break
	if found == False:
		print(-1)


cases = int(input())
result = []
for i in range(cases):
	a = int(input())
	bids = list(map(int, input().split()))
	val = sorted(bids)
	done = 0
	if len(bids) == 1:
		result.append(0)
		done = 1
		continue
	if val[0] != val[1]:
		result.append(bids.index(val[0]))
		done = 1
	else:
		for j in range(1, a):
			if j == a - 1:
				if val[j] != val[j - 1]:
					result.append(bids.index(val[a - 1]))
					done = 1
					break
			elif val[j - 1] != val[j] and val[j] != val[j + 1]:
				result.append(bids.index(val[j]))
				done = 1
				break
	if done == 0:
		result.append(-2)
for i in result:
	print(i + 1)


import sys
t = int(input())
for num in range(t):
	n = int(sys.stdin.readline())
	numbers = list(map(int, sys.stdin.readline().split()))
	dic = {}
	for number in numbers:
		if number not in dic:
			dic[number] = 1
		else:
			dic[number] += 1
	if 1 not in dic.values():
		print(-1)
	else:
		keys = list(dic.keys())
		keys.sort()
		for key in keys:
			if dic[key] == 1:
				print(numbers.index(key) + 1)
				break


from collections import Counter

def solve():
	n = int(input())
	vals = [*map(int, input().split())]
	c = Counter(vals)
	out = -1
	for (idx, v) in enumerate(vals, 1):
		if c[v] == 1:
			if out == -1:
				out = idx
			elif vals[out - 1] > v:
				out = idx
	print(out)
t = int(input())
while t:
	solve()
	t = t - 1


for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	if n == 1:
		print(1)
	else:
		sorts = [(vals[s], s + 1) for s in range(n)]
		sorts.sort(key=lambda x: x[0])
		found = False
		num = -1
		for s in range(n):
			if s == 0:
				if sorts[s][0] != sorts[s + 1][0]:
					found = True
					num = sorts[s][1]
					break
			elif s == n - 1:
				if sorts[s][0] != sorts[s - 1][0]:
					found = True
					num = sorts[s][1]
					break
			elif sorts[s][0] != sorts[s - 1][0] and sorts[s][0] != sorts[s + 1][0]:
				found = True
				num = sorts[s][1]
				break
		if found == True:
			print(num)
		else:
			print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	arr = sorted(l, key=lambda x: x)
	i = 0
	a = arr[0]
	flag = 1
	if n == 1:
		print(1)
		continue
	while i < n:
		if i == 0 and arr[0] != arr[1]:
			print(l.index(arr[0]) + 1)
			flag = 0
			break
		elif i == n - 1 and arr[n - 1] != arr[n - 2]:
			print(l.index(arr[n - 1]) + 1)
			flag = 0
			break
		elif arr[i - 1] != arr[i] and arr[i] != arr[i + 1]:
			print(l.index(arr[i]) + 1)
			flag = 0
			break
		i += 1
	if flag:
		print('-1')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = set()
	b = set()
	for j in l:
		if j not in a:
			a.add(j)
			b.add(j)
		elif j in b:
			b.remove(j)
	if len(b) == 0:
		print(-1)
	else:
		print(l.index(min(b)) + 1)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	freq = {}
	for i in arr:
		if i in freq:
			freq[i] += 1
		else:
			freq[i] = 1
	check = 0
	for i in sorted(freq):
		if freq[i] == 1:
			ans = i
			check = 1
			break
	if check == 0:
		print(-1)
	else:
		for i in range(len(arr)):
			if arr[i] == ans:
				print(i + 1)
				break


from bisect import *
from collections import *
from random import *
from decimal import *
from random import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	f = float('inf')
	v = Counter(a)
	for i in v.keys():
		if v[i] == 1:
			f = min(f, i)
	if f == float('inf'):
		f = -1
	else:
		f = a.index(f) + 1
	print(f)


import math
from collections import Counter, defaultdict, deque

def f(n, a):
	ca = Counter(a)
	for n in sorted(ca.keys()):
		if ca[n] == 1:
			return a.index(n) + 1
	return -1
t = int(input())
result = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	result.append(f(n, a))
for i in range(t):
	print(result[i])


x = input()
x = int(x)
num = 0
all_data = []
for i in range(x):
	num = input()
	num = int(num)
	_t = input()
	a = [int(i) for i in _t.split()]
	all_data.append(a)
for s in all_data:
	x = sorted(s)
	m = x[0]
	index = 0
	dup = False
	for i in range(1, len(x)):
		if m == x[i]:
			dup = True
		if m != x[i] and dup:
			index = i
			m = x[i]
			dup = False
	if dup:
		print(-1)
	else:
		print(s.index(m) + 1)


t = int(input())
b = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = max(a) + 1
	c = [0] * d
	for i1 in a:
		c[i1] += 1
	del c[0]
	b1 = []
	for i1 in range(len(c)):
		if c[i1] == 1:
			b1 += [i1 + 1]
	if b1 == []:
		b.append(-1)
	else:
		b11 = min(b1)
		b.append(a.index(b11) + 1)
for i in b:
	print(i)


import collections
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	v = collections.Counter(a)
	m = n + 1
	for i in v:
		if v[i] == 1:
			m = min(m, i)
	if m == n + 1:
		print(-1)
	else:
		print(a.index(m) + 1)


for i in range(int(input())):
	a = int(input())
	arr = [int(i) for i in input().split()]
	re = [0 for i in range(a)]
	for i in arr:
		re[i - 1] = re[i - 1] + 1
	if 1 in re:
		print(arr.index(re.index(1) + 1) + 1)
	else:
		print(-1)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		arr = get_list()
		dic = dict()
		for i in range(n):
			if arr[i] not in dic:
				dic[arr[i]] = [1, i]
			else:
				dic[arr[i]][0] += 1
		minn = maxsize
		ind = -1
		for (i, j) in dic.items():
			if j[0] == 1:
				if i < minn:
					minn = i
					ind = j[1] + 1
		get_print_int(ind)
solve()


import sys

def read(func=int):
	return func(sys.stdin.readline().strip())

def readList(func=int):
	return list(map(func, sys.stdin.readline().strip().split()))
t = read()
for _ in range(t):
	n = read()
	A = readList()
	B = list(enumerate(A))
	B.sort(key=lambda x: x[1])
	found = False
	for i in range(n):
		if i == 0:
			if n == 1 or B[i][1] != B[i + 1][1]:
				print(B[i][0] + 1)
				found = True
				break
		elif i < n - 1:
			if B[i][1] != B[i - 1][1] and B[i][1] != B[i + 1][1]:
				print(B[i][0] + 1)
				found = True
				break
		elif B[i][1] != B[i - 1][1]:
			print(B[i][0] + 1)
			found = True
			break
	if not found:
		print(-1)


import math, sys, itertools
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 2] for i in range(1, len(wtf), 2)]:
	n = int(t[0])
	A = list(map(int, t[1].split()))
	ans = dict()
	for (j, v) in enumerate(A):
		ans[v] = 1 if v not in ans else ans[v] + 1
	k = min([j for (j, v) in ans.items() if v == 1], default=-1)
	print(A.index(k) + 1 if k >= 0 and k <= n else -1)


lines = int(input())
answer = [0] * lines
for line in range(lines):
	participates = int(input())
	num = [0] * (participates + 1)
	per = [0] * (participates + 1)
	find = False
	k = input()
	temp = list(map(int, k.split(' ')))
	for (idx, value) in enumerate(temp):
		num[value] += 1
		per[idx + 1] = value
	for i in range(participates + 1):
		if num[i] == 1:
			for (j, v) in enumerate(per):
				if v == i:
					answer[line] = j
					find = True
					break
		if find:
			break
	if not find:
		answer[line] = -1
for a in answer:
	print(int(a))


T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	oldarr = arr.copy()
	arr.sort()
	ans = -1
	if n == 1 or arr[0] != arr[1]:
		ans = arr[0]
	else:
		for i in range(1, n - 1):
			if arr[i] != arr[i - 1] and arr[i] != arr[i + 1]:
				ans = arr[i]
				break
	if ans == -1 and arr[n - 1] != arr[n - 2]:
		ans = arr[n - 1]
	if ans != -1:
		for i in range(n):
			if oldarr[i] == ans:
				ans = i + 1
				break
	print(ans)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	freq = defaultdict(lambda : 0)
	for val in arr:
		freq[val] += 1
	ans = []
	for val in freq:
		if freq[val] == 1:
			ans.append(val)
	if ans:
		print(arr.index(min(ans)) + 1)
	else:
		print(-1)


for test in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [False] * (n + 2)
	for val in a:
		cnt[val] += 1
	ans = -2
	minValue = n * 2
	for i in range(0, n):
		if cnt[a[i]] == 1:
			if a[i] < minValue:
				ans = i
				minValue = a[i]
	print(ans + 1)


t = int(input())
lan = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = []
	indx = [0]
	flag = False
	counter = 0
	for i in range(max(arr) + 1):
		cnt.append(0)
		indx.append(0)
	for i in arr:
		cnt[i] += 1
		indx[i] = counter
		counter += 1
	for i in range(max(arr) + 1):
		if cnt[i] == 1:
			lan.append(indx[i] + 1)
			flag = True
			break
		else:
			continue
	if flag == False:
		lan.append(-1)
print(*lan, sep='\n')


import sys

def read_int():
	return int(sys.stdin.readline())

def read_ints():
	return map(int, sys.stdin.readline().split(' '))
t = read_int()
ans = []
for case_num in range(t):
	n = read_int()
	a = list(read_ints())
	cnt = [[] for _ in range(n + 1)]
	for (i, ai) in enumerate(a):
		cnt[ai].append(i + 1)
	found = False
	for i in range(1, n + 1):
		if len(cnt[i]) == 1:
			found = True
			ans.append(str(cnt[i][0]))
			break
	if not found:
		ans.append('-1')
print('\n'.join(ans))


import sys
import os

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
	x

def take_input():
	if os.environ.get('check'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
take_input()
for i in range(int(input())):
	n = int(input())
	arr = int_array()
	hsh = {}
	for i in arr:
		hsh[i] = hsh.get(i, 0) + 1
	INF = float('inf')
	ans = INF
	for k in hsh:
		v = hsh[k]
		if v == 1:
			ans = min(ans, k)
	if ans == INF:
		print(-1)
	else:
		print(arr.index(ans) + 1)


def solve():
	n = int(input())
	w = {}
	a = [int(i) for i in input().split()]
	for i in range(n):
		if a[i] in w:
			w[a[i]] += 1
		else:
			w[a[i]] = 1
	q = set()
	for i in w:
		if w[i] == 1:
			q.add(i)
	q = sorted(list(q))
	if len(q) >= 1:
		return a.index(q[0]) + 1
	return -1
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


t = int(input())
for _ in range(t):
	contagem = dict()
	n = int(input())
	aux = list(map(int, input().split()))
	for i in range(n):
		if aux[i] in contagem:
			contagem[aux[i]].append(i + 1)
		else:
			contagem[aux[i]] = [i + 1]
	res = -1
	pos = 1000000000.0
	for i in sorted(contagem):
		if len(contagem[i]) == 1:
			res = contagem[i][0]
			break
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	lst1 = list(map(int, input().split()))
	dict1 = {}
	for i in range(len(lst1)):
		if lst1[i] in dict1:
			dict1[lst1[i]] += 1
		else:
			dict1[lst1[i]] = 1
	ans = float('inf')
	for j in sorted(dict1):
		if dict1[j] == 1 and j < ans:
			ans = j
	if ans == float('inf'):
		print(-1)
	else:
		for i in range(len(lst1)):
			if ans == lst1[i]:
				print(i + 1)
				break


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	a = sorted(Counter(b).most_common(), key=lambda x: (x[1], x[0]))
	if a[0][1] == 1 and a[0][0] in list(b):
		print(list(b).index(a[0][0]) + 1)
	else:
		print(-1)


t = int(input())
for i in range(t):
	d = dict()
	n = int(input())
	s = list(map(int, input().split()))
	for j in range(n):
		if s[j] in d:
			d[s[j]] = 'net'
		else:
			d[s[j]] = j
	mn = 10 ** 9
	mn2 = 10 ** 9
	for j in d:
		if d[j] != 'net' and j < mn2:
			mn = d[j]
			mn2 = j
	if mn == 10 ** 9:
		print(-1)
	else:
		print(mn + 1)


from collections import defaultdict

def default_value():
	return 0

def find_winner(L):
	d = defaultdict(default_value)
	ind_dict = dict()
	for (i, l) in enumerate(L):
		d[l] += 1
		ind_dict[l] = i + 1
	result = -1
	for (key, value) in d.items():
		if result == -1 and value == 1:
			result = key
		elif result != -1 and value == 1 and (key < result):
			result = key
	return -1 if result == -1 else ind_dict[result]
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(find_winner(a))


for _ in range(int(input())):
	(n, s) = (int(input()), -1)
	a = list(map(int, input().split(' ')))
	b = sorted(a)
	if n == 1 or b[0] != b[1]:
		s = a.index(b[0]) + 1
	if s == -1:
		for i in range(1, len(b) - 1):
			if b[i - 1] != b[i] and b[i] != b[i + 1]:
				s = a.index(b[i]) + 1
				break
	if s == -1 and b[-1] != b[-2]:
		s = a.index(b[-1]) + 1
	print(s)


for _ in range(int(input())):
	n = int(input())
	lst = [0] * n
	a = [int(i) for i in input().split()]
	for i in a:
		lst[i - 1] += 1
	print(a.index(lst.index(1) + 1) + 1) if 1 in lst else print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	times = [0] * (n + 1)
	index = [0] * (n + 1)
	for j in range(len(arr)):
		times[arr[j]] += 1
		index[arr[j]] = j + 1
	flag = 0
	for j in range(len(times)):
		if times[j] == 1:
			flag = 1
			print(index[j])
			break
	if flag == 0:
		print(-1)


import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline().rstrip()
inf = 10 ** 16
md = 10 ** 9 + 7
from collections import Counter

def solve(l):
	m = Counter(l)
	for i in sorted(m.keys()):
		if m[i] == 1:
			print(l.index(i) + 1)
			return
	print(-1)
for _ in range(II()):
	n = II()
	l = LI()
	solve(l)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = a.copy()
	b.sort()
	m = b[0]
	flag = True
	for i in range(1, n):
		if m == b[i]:
			flag = False
		elif not flag:
			m = b[i]
			flag = True
	if not flag:
		print(-1)
	else:
		print(a.index(m) + 1)


t = int(input())
LST = []
for case in range(t):
	n = int(input())
	wanted = 10000000000.0
	strlst = input().split()
	numlst = [int(d) for d in strlst]
	numdic = {}
	for num in numlst:
		if numdic.get(num) is None:
			numdic[num] = 1
		else:
			numdic[num] += 1
	for key in numdic.keys():
		if numdic[key] == 1 and key < wanted:
			wanted = key
	if wanted == 10000000000.0:
		LST.append(-1)
	else:
		LST.append(numlst.index(wanted) + 1)
for i in LST:
	print(i)


def get_winner(bids):
	bids = [[j, i + 1] for (i, j) in enumerate(bids)]
	bids.sort()
	unique = True
	cur_winner = bids[0]
	for b in bids[1:]:
		if b[0] != cur_winner[0]:
			if unique:
				return cur_winner[1]
			else:
				cur_winner = b
				unique = True
		else:
			unique = False
	if unique:
		return cur_winner[1]
	return -1
for i in range(int(input())):
	n = int(input())
	b = [int(i) for i in input().split()]
	print(get_winner(b))


import sys

def WinnerIndex(arr):
	dict = {}
	res = sys.maxsize
	resIndex = -1
	for i in arr:
		dict[i] = dict.get(i, 0) + 1
	for i in range(len(arr)):
		if dict[arr[i]] == 1 and arr[i] < res:
			res = arr[i]
			resIndex = i
	if resIndex != -1:
		return resIndex + 1
	else:
		return -1
n = int(input())
while n > 0:
	p = int(input())
	arr = [int(x) for x in input().split()]
	print(WinnerIndex(arr))
	n -= 1


import collections
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	d = collections.Counter(a)
	d = dict(sorted(d.items(), key=lambda item: item[0]))
	x = []
	for i in d:
		if d[i] == 1:
			x.append(i)
	if len(x) == 0:
		print(-1)
	else:
		x.sort()
		print(a.index(x[0]) + 1)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = a.copy()
	a.sort()
	i = 0
	index = -2
	if len(a) == 1:
		print(1)
		continue
	elif len(a) == 2:
		if a[1] == a[0]:
			print(-1)
			continue
		else:
			print(b.index(a[0]) + 1)
			continue
	if a[0] < a[1]:
		print(b.index(a[0]) + 1)
		continue
	while i < n - 2:
		if a[i] != a[i + 1] and a[i + 1] != a[i + 2]:
			index = b.index(a[i + 1])
			break
		i += 1
	if index != -2:
		print(index + 1)
		continue
	elif a[n - 1] == a[n - 2]:
		print(-1)
		continue
	else:
		print(b.index(a[n - 1]) + 1)


from sys import *
import math
input = stdin.readline
for _ in range(int(input())):
	sna = math.inf
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1 and n > 1:
		print(-1)
	else:
		aaa = {}
		aaaa = {}
		for kk in range(n):
			if arr[kk] not in aaaa:
				aaaa[arr[kk]] = 1
			else:
				aaaa[arr[kk]] = 2
			aaa[arr[kk]] = kk + 1
		for kj in aaa:
			if aaaa[kj] == 1:
				if sna > kj:
					inde = aaa[kj]
					sna = kj
		if sna == math.inf:
			print(-1)
		else:
			print(inde)


res = ''
for _ in range(int(input())):
	n = int(input())
	arr = tuple(map(int, input().split()))
	counts = [0] * (n + 1)
	for bid in arr:
		counts[bid] += 1
	ans = -1
	curr_min = n + 1
	for (i, bid) in enumerate(arr):
		if counts[bid] == 1:
			if bid < curr_min:
				curr_min = bid
				ans = i + 1
	res += str(ans) + '\n'
print(res)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	l1 = []
	for i in l:
		d[i] = 0
	for i in l:
		d[i] += 1
	for i in d:
		if d[i] == 1:
			l1.append(i)
	print(l.index(min(l1)) + 1 if len(l1) > 0 else -1)


for i in range(int(input())):
	n = int(input())
	t = list(map(int, input().split()))
	f = {}
	for j in t:
		if j not in f:
			f[j] = 1
		else:
			f[j] += 1
	ans = 9999999999
	for k in f.keys():
		if f[k] == 1:
			ans = min(k, ans)
	if ans == 9999999999:
		print(-1)
	else:
		print(t.index(ans) + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	counts = [0 for i in range(n + 1)]
	for i in a:
		counts[i] += 1
	best = -1
	for i in range(n):
		if counts[a[i]] == 1 and (best == -1 or a[best] > a[i]):
			best = i
	print(-1 if best == -1 else best + 1)


def solve():
	n = int(input())
	try:
		arr = list(map(int, input().split()))
		temp = dict()
		for i in arr:
			if i not in temp:
				temp[i] = 1
			else:
				temp[i] += 1
		unique = []
		for i in temp:
			if temp[i] == 1:
				unique.append(i)
		if len(unique) == 0:
			print(-1)
		else:
			print(arr.index(min(unique)) + 1)
	except EOFError as e:
		print(e)
for case in range(int(input())):
	solve()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	x = []
	for i in d:
		if d[i] == 1:
			x.append(i)
	x.sort()
	if x == []:
		print(-1)
		continue
	f = x[0]
	for i in range(n):
		if a[i] == f:
			print(i + 1)
			break


for _ in range(int(input())):
	n = int(input())
	d = {}
	arr = list(map(int, input().split()))
	uni = list(set(arr))
	uni.sort()
	ans = -1
	cnt = 0
	mapper = {}
	for i in arr:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
		mapper[i] = cnt
		cnt += 1
	for i in uni:
		if d[i] == 1:
			ans = i
			break
	if ans == -1:
		print(ans)
	else:
		print(mapper[ans] + 1)


from collections import Counter
T = int(input())
for case in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	u = {key: value for (key, value) in Counter(a).items() if value == 1}
	if len(u) == 0:
		print(-1)
	else:
		print(a.index(min(u)) + 1)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [[] for _ in range(n)]
	for (i, x) in enumerate(a):
		cnt[x - 1].append(i + 1)
	for (i, l) in enumerate(cnt):
		if len(l) == 1:
			print(l[0])
			return
	print(-1)
t = int(input())
for _ in range(t):
	solve()


for (n, arr) in [[int(input()), [int(x) for x in input().split()]] for _ in ' ' * int(input())]:
	z = [0] * (n + 1)
	for elem in arr:
		z[elem] += 1
	print(arr.index(z.index(1)) + 1) if 1 in z else print(-1)


t = int(input())
while t:
	n = int(input())
	lis = list(map(int, input().split()))
	if len(lis) == 1:
		print(1)
	else:
		sort = sorted(lis)
		dic = {}
		for item in sort:
			if item in dic:
				dic[item] += 1
			else:
				dic[item] = 1
		for (k, v) in dic.items():
			if v == 1:
				print(lis.index(k) + 1)
				break
		else:
			print(-1)
	t -= 1


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	counter = [0] * n
	for j in l:
		counter[j - 1] += 1
	if 1 in counter:
		print(l.index(counter.index(1) + 1) + 1)
	else:
		print(-1)


from collections import OrderedDict
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	dict = OrderedDict()
	for i in range(n):
		if arr[i] in dict:
			dict[arr[i]] += 1
		else:
			dict[arr[i]] = 1
	ans = 2 * 10 ** 5 + 1
	for i in dict:
		if dict[i] == 1 and i < ans:
			ans = i
	if ans == 2 * 10 ** 5 + 1:
		print(-1)
	else:
		print(arr.index(ans) + 1)


from collections import Counter

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		d = dict(Counter(a))
		l = []
		for (i, j) in enumerate(a):
			if d[j] == 1:
				l.append([j, i])
		try:
			print(min(l)[1] + 1)
		except:
			print(-1)
main()


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)


t = int(input())
for i in range(t):
	s = int(input())
	mas = input().split(' ')
	mas2 = []
	res = []
	dc = {}
	for k in range(len(mas)):
		mas[k] = int(mas[k])
		mas2.append(mas[k])
		if dc.get(mas[k]):
			dc[mas[k]] = dc[mas[k]] + 1
		else:
			dc[mas[k]] = 1
	mas2.sort()
	for k in range(len(mas2) - 1):
		if mas2[k] != mas2[k + 1]:
			res.append(mas2[k])
	res.append(mas2[len(mas2) - 1])
	res2 = -1
	for k in res:
		if dc[k] == 1:
			res2 = k
			break
	for k in range(len(mas)):
		if mas[k] == res2:
			print(k + 1)
			break
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	b = [0] * (n + 1)
	for elem in l:
		b[elem] += 1
	print(l.index(b.index(1)) + 1) if 1 in b else print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	dict = {}
	for j in set(a):
		dict[j] = []
	keys = list(dict.keys())
	keys.sort()
	for j in range(n):
		dict[a[j]].append(j + 1)
	k = -1
	for i in keys:
		if len(dict[i]) == 1:
			k = dict[i][0]
			break
	print(k)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	d = defaultdict(list)
	for (i, a) in enumerate(A):
		d[a].append(i + 1)
	keys = sorted(d.keys())
	for k in keys:
		if len(d[k]) == 1:
			print(d[k][0])
			break
	else:
		print(-1)


def process():
	n = int(input())
	le = list(map(int, input().split()))
	if n == 1:
		return 1
	l = sorted(le)
	repeated = False
	last = l[0]
	num = -1
	for i in l[1:]:
		if i == last:
			repeated = True
		elif not repeated:
			num = last
			break
		else:
			repeated = False
			last = i
	if not repeated:
		num = last
	if num == -1:
		return -1
	for i in range(n):
		if le[i] == num:
			return i + 1

def main():
	for i in range(int(input())):
		print(process())
main()


for _ in range(int(input())):
	n = int(input())
	ass = [int(x) for x in input().split()]
	pos = {}
	counts = set()
	bad = set()
	for i in range(len(ass)):
		pos[ass[i]] = i
		if ass[i] in bad:
			continue
		if ass[i] in counts:
			bad.add(ass[i])
			counts.remove(ass[i])
		else:
			counts.add(ass[i])
	if len(counts) == 0:
		print(-1)
	else:
		print(pos[min(counts)] + 1)


d = {}
acc = 0
ind = 0
min = 200001
t = int(input())
for i in range(t):
	min = 200001
	cont = 0
	n = int(input())
	a = input().split()
	list = a
	for j in range(n):
		if a[j] in d:
			d[a[j]] += 1
		else:
			d[a[j]] = 1
	for j in d:
		cont += 1
		if d[j] == 1:
			if int(j) < min:
				min = int(j)
				ind = cont
			acc = 1
	if acc == 0:
		ind = -1
		print(ind)
	else:
		for j in range(n):
			if min == int(list[j]):
				print(j + 1)
	acc = 0
	d.clear()


from collections import *
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	dict_1 = Counter(arr)
	final = []
	for (key, value) in dict_1.items():
		if value == 1:
			final.append(key)
	if len(final) == 0:
		print(-1)
	else:
		m = min(final)
		for i in range(len(arr)):
			if arr[i] == m:
				print(i + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	l1 = l
	for i in l:
		if i in d:
			d[i] = d[i] + 1
		else:
			d[i] = 1
	c = 0
	for i in d:
		if d[i] == 1:
			if c == 0:
				c = i
			elif i < c:
				c = i
	k = 0
	for i in range(len(l)):
		if l1[i] == c:
			k = i + 1
	if k == 0:
		print(-1)
	else:
		print(k)


t = input()
t = int(t)
ans = []
for i in range(t):
	n = input()
	n = int(n)
	a = input().split()
	a = list(map(int, a))
	b = list(a)
	b.sort()
	x = b[0]
	j = 1
	while j < n:
		if x > 0:
			if x == b[j]:
				x = -x
				j += 1
			elif x < b[j]:
				j = n
		elif -x < b[j]:
			x = b[j]
			j += 1
		elif -x == b[j]:
			j += 1
	if x < 0:
		ans.append(-1)
	else:
		ans.append(a.index(x) + 1)
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for z in range(n):
		if a[z] in d:
			d[a[z]] += 1
		else:
			d[a[z]] = 1
	ans = 10 ** 20
	idx = -2
	for z in range(n):
		if d[a[z]] == 1:
			if a[z] < ans:
				ans = a[z]
				idx = z
	print(idx + 1)


def FindDuplicates(arr):
	HashMap = {}
	Duplicates = set()
	n = len(arr)
	for i in range(n):
		if arr[i] not in HashMap.keys():
			HashMap[arr[i]] = 1
		else:
			Duplicates.add(arr[i])
	return Duplicates
t = int(input())
N = []
A = []
for _ in range(t):
	N.append(int(input()))
	A.append(list(map(int, input().rstrip().split())))
Sol = []
for i in range(t):
	n = N[i]
	a = A[i]
	S = FindDuplicates(a)
	if len(S) == 0:
		Sol.append(a.index(min(a)) + 1)
	else:
		minSet = min(S)
		minArr = min(a)
		if minArr == minSet:
			aa = set(a)
			diff = aa - S
			if len(diff) == 0:
				Sol.append(-1)
			else:
				Sol.append(a.index(min(diff)) + 1)
		else:
			Sol.append(a.index(minArr) + 1)
for ele in Sol:
	print(ele)


t = int(input())

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	ans = -1
	d = {}
	for i in arr:
		if i not in d:
			d[i] = 1
		else:
			d[i] = 2
	m = 9999999999999
	ans = -1
	for (i, v) in enumerate(arr):
		if d[v] >= 2:
			continue
		elif v < m:
			m = v
			ans = i + 1
	print(ans)
for _ in range(t):
	solve()


t = int(input())
res = []
i = 0
while i < t:
	n = int(input())
	lista = list(map(int, input().split()))
	mapa = {}
	for j in range(len(lista)):
		if mapa.get(lista[j]) == None:
			mapa[lista[j]] = [1, j]
		else:
			mapa[lista[j]][0] += 1
	imenor = -2
	for chave in mapa.keys():
		if mapa[chave][0] == 1:
			if imenor == -2:
				imenor = mapa[chave][1]
			elif lista[mapa[chave][1]] < lista[imenor]:
				imenor = mapa[chave][1]
	res.append(imenor)
	i += 1
for e in res:
	print(e + 1)


for i in range(int(input())):
	ind = -1
	ans = -1
	n = int(input())
	a = list(map(int, input().split()))
	b = a
	b = sorted(b)
	if n == 1:
		ind = 1
	else:
		for j in range(n):
			if j == 0 and b[0] != b[1]:
				ans = b[j]
				break
			elif j != n - 1:
				if b[j] != b[j - 1] and b[j] != b[j + 1]:
					ans = b[j]
					break
			elif b[j] != b[j - 1]:
				ans = b[j]
				break
	for j in range(n):
		if a[j] == ans:
			ind = j + 1
			break
	print(ind)


def game(arr):
	tmp = arr[:]
	tmp.sort()
	curr_score = tmp[0]
	change = False
	for i in range(1, len(tmp)):
		if tmp[i] == curr_score:
			change = True
			continue
		if change and tmp[i] != curr_score:
			curr_score = tmp[i]
			change = False
	if change:
		return -1
	else:
		for i in range(len(arr)):
			if arr[i] == curr_score:
				return i + 1

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().strip().split()))
		ind = game(arr)
		print(ind)
main()


for i in range(int(input())):
	n = int(input())
	ans = -1
	d = dict()
	l = list(map(int, input().split()))
	for i in range(n):
		if l[i] in d:
			d[l[i]] += 1
		else:
			d[l[i]] = 1
	for i in range(n):
		if d[l[i]] == 1 and (ans < 0 or l[i] < l[ans]):
			ans = i
	if ans == -1:
		print(ans)
	else:
		print(ans + 1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in range(len(l)):
		if l[i] in d:
			d[l[i]].append(i + 1)
		else:
			d[l[i]] = [i + 1]
	a = []
	flag = 0
	for i in d:
		if len(d[i]) == 1:
			flag = 1
			a.append([i, d[i][0]])
	if flag:
		a.sort()
		print(a[0][1])
	else:
		print(-1)


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	from collections import Counter
	t = int(input())
	ans = ['-1'] * t
	for ti in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		counter = Counter(a)
		for key in sorted(counter.keys()):
			if counter[key] == 1:
				ans[ti] = str(a.index(key) + 1)
				break
	sys.stdout.buffer.write(('\n'.join(ans) + '\n').encode('utf-8'))
main()


import sys
input = sys.stdin.readline

def find_unique_bid(bids):
	sorted_bids = bids.copy()
	sorted_bids.sort()
	i = 0
	sorted_bids += [-1, -2]
	while True:
		if sorted_bids[i] != sorted_bids[i + 1]:
			return sorted_bids[i]
		j = i + 1
		while sorted_bids[j] == sorted_bids[j + 1]:
			j += 1
		i = j + 1
	return -1
t = int(input())
for item in range(t):
	n = int(input())
	bids = [int(bid) for bid in input().split()]
	unique_bid = find_unique_bid(bids)
	if unique_bid == -1:
		print(-1)
	else:
		print(bids.index(unique_bid) + 1)


from collections import defaultdict
test = int(input())
for i in range(test):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	fre = defaultdict(int)
	for i in a:
		if i not in fre:
			fre[i] = 1
		else:
			fre[i] += 1
	ans = 2000001
	for i in fre:
		if fre[i] == 1:
			ans = min(ans, i)
	if ans == 2000001:
		print(-1)
	else:
		for i in range(n):
			if a[i] == ans:
				print(i + 1)
				break


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	d = {}
	di = {}
	count = 1
	for i in l:
		if i not in d:
			d[i] = 0
			di[i] = count
		else:
			d[i] += 1
		count += 1
	res = 999999999
	fres = -1
	for (i, v) in d.items():
		if v == 0:
			if i < res:
				res = i
				fres = di[i]
	if res == 999999999:
		print(-1)
	else:
		print(fres)


x = int(input())
for i in range(x):
	n = int(input())
	l = list(map(int, input().split()))
	g = l.copy()
	l.sort()
	d = {}
	for j in l:
		if j in d:
			d[j] += 1
		else:
			d[j] = 1
	for j in d:
		if d[j] == 1:
			print(g.index(j) + 1)
			break
	else:
		print(-1)


t = int(input())
ans = [0] * t
for i in range(t):
	min = -1
	n = int(input())
	b = list(map(int, input().split()))
	a = sorted(b)
	if n != 1:
		if a[0] != a[1]:
			min = a[0]
		else:
			for j in range(1, n - 1):
				if a[j - 1] != a[j] and a[j + 1] != a[j]:
					min = a[j]
					break
			if a[n - 1] != a[n - 2] and min == -1:
				min = a[n - 1]
	else:
		min = b[0]
	if min != -1:
		for j in range(n):
			if b[j] == min:
				ans[i] = j + 1
	else:
		ans[i] = -1
for i in range(t):
	print(ans[i])


loopcount = int(input())
dic = {}
for loop in range(loopcount):
	a = int(input())
	b = input()
	x = b.split(' ')
	x = list(map(int, x))
	y = x.copy()
	y.sort()
	if b in dic.keys():
		print(dic[b])
	else:
		answer = -1
		i = 0
		while i < a:
			if i + 1 < a and y[i] == y[i + 1]:
				duplicate = y[i]
				j = i + 1
				while j < a:
					if y[j] == duplicate:
						j += 1
						i = j
					else:
						i = j
						break
			else:
				answer = x.index(y[i]) + 1
				break
		dic[b] = answer
		print(answer)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	L = []
	for i in range(n):
		L.append([l[i], i + 1])
	L.sort()
	if n == 1:
		print(1)
	else:
		flag = 0
		if L[1][0] != L[0][0]:
			print(L[0][1])
		else:
			j = 0
			for i in range(1, n - 1):
				if L[i][0] != L[i - 1][0] and L[i][0] != L[i + 1][0]:
					j = L[i][1]
					flag = 1
					break
			if flag == 1:
				print(j)
			elif L[n - 1][0] != L[n - 2][0]:
				print(L[n - 1][1])
			else:
				print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	s = [0] * n
	for i in lst:
		s[i - 1] += 1
	if 1 in s:
		print(lst.index(s.index(1) + 1) + 1)
	else:
		print(-1)