import javafx.beans.binding.StringBinding;

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int tc = sc.nextInt();
        while(tc --> 0){
            int n = sc.nextInt();
            int[] arr = new int[n];
            int[] freqArr = new int[n + 1];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                freqArr[arr[i]]++;
            }
            int ans = -1;
            for (int i = 0; i < n; i++) {
                if(freqArr[arr[i]] == 1){
                    ans = i + 1;
                    break;
                }
            }
            pw.println(ans);
        }
        pw.close();
    }

    public static long mod(long a, long b){
        long m = a % b;
        if(m < 0) m += Math.abs(b);
        return m;
    }
    public static void sort(int[] arr){
        ArrayList<Integer> l = new ArrayList<>();
        for(int i : arr) l.add(i);
        Collections.sort(l, Collections.reverseOrder());
        for (int i = 0; i < arr.length; i++) {
            arr[i] = l.get(i);
        }
    }
    public static long C(int n, int k){
        double res = 1;
        for (int i = 1; i <= k; i++) {
            res *= (double) (n - k + i) / i;
        }
        return (long) (res + 0.01);
    }

    static class Pair{
        int x, y;
        public Pair(int x, int y){
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return "(" + x + "," + y + ")";
        }
    }
    static class SegmentTree{		// 1-based DS, OOP
        int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
        int[] array, sTree, lazy;

        SegmentTree(int[] in)
        {
            array = in; N = in.length - 1;
            sTree = new int[N<<1];		//no. of nodes = 2*N - 1, we add one to cross out index zero
            lazy = new int[N<<1];
            build(1,1,N);
        }

        void build(int node, int b, int e)	// O(n)
        {
            if(b == e)
                sTree[node] = array[b];
            else
            {
                int mid = b + e >> 1;
                build(node<<1,b,mid);
                build(node<<1|1,mid+1,e);
                sTree[node] = sTree[node<<1]+sTree[node<<1|1];
            }
        }

        void update_point(int index, int val)			// O(log n)
        {
            index += N - 1;
            sTree[index] += val;
            while(index>1)
            {
                index >>= 1;
                sTree[index] = sTree[index<<1] + sTree[index<<1|1];
            }
        }

        void update_range(int i, int j, int val)		// O(log n)
        {
            update_range(1,1,N,i,j,val);
        }

        void update_range(int node, int b, int e, int i, int j, int val)
        {
            if(i > e || j < b)
                return;
            if(b >= i && e <= j)
            {
                sTree[node] += (e-b+1)*val;
                lazy[node] += val;
            }
            else
            {
                int mid = b + e >> 1;
                propagate(node, b, mid, e);
                update_range(node<<1,b,mid,i,j,val);
                update_range(node<<1|1,mid+1,e,i,j,val);
                sTree[node] = sTree[node<<1] + sTree[node<<1|1];
            }

        }
        void propagate(int node, int b, int mid, int e)
        {
            lazy[node<<1] += lazy[node];
            lazy[node<<1|1] += lazy[node];
            sTree[node<<1] += (mid-b+1)*lazy[node];
            sTree[node<<1|1] += (e-mid)*lazy[node];
            lazy[node] = 0;
        }

        int query(int i, int j)
        {
            return query(1,1,N,i,j);
        }

        int query(int node, int b, int e, int i, int j)	// O(log n)
        {
            if(i>e || j <b)
                return 0;
            if(b>= i && e <= j)
                return sTree[node];
            int mid = b + e >> 1;
            propagate(node, b, mid, e);
            int q1 = query(node<<1,b,mid,i,j);
            int q2 = query(node<<1|1,mid+1,e,i,j);
            return q1 + q2;

        }
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public int[] nextIntArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(next());
            }
            return arr;
        }

        public long[] nextLongArr(int n) throws IOException {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(next());
            }
            return arr;
        }

    }
}


import javafx.beans.binding.StringBinding;

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int tc = sc.nextInt();
        while(tc --> 0){
            int n = sc.nextInt();
            int[] arr = new int[n];
            int[] freqArr = new int[n + 1];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                freqArr[arr[i]]++;
            }
            int ans = -1;
            int num = (int) 1e9;
            for (int i = 0; i < n; i++) {
                if(freqArr[arr[i]] == 1){
                    if(arr[i] < num){
                        ans = i + 1; num= arr[i];
                    }
                }
            }
            pw.println(ans);
        }
        pw.close();
    }

    public static long mod(long a, long b){
        long m = a % b;
        if(m < 0) m += Math.abs(b);
        return m;
    }
    public static void sort(int[] arr){
        ArrayList<Integer> l = new ArrayList<>();
        for(int i : arr) l.add(i);
        Collections.sort(l, Collections.reverseOrder());
        for (int i = 0; i < arr.length; i++) {
            arr[i] = l.get(i);
        }
    }
    public static long C(int n, int k){
        double res = 1;
        for (int i = 1; i <= k; i++) {
            res *= (double) (n - k + i) / i;
        }
        return (long) (res + 0.01);
    }

    static class Pair{
        int x, y;
        public Pair(int x, int y){
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return "(" + x + "," + y + ")";
        }
    }
    static class SegmentTree{		// 1-based DS, OOP
        int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
        int[] array, sTree, lazy;

        SegmentTree(int[] in)
        {
            array = in; N = in.length - 1;
            sTree = new int[N<<1];		//no. of nodes = 2*N - 1, we add one to cross out index zero
            lazy = new int[N<<1];
            build(1,1,N);
        }

        void build(int node, int b, int e)	// O(n)
        {
            if(b == e)
                sTree[node] = array[b];
            else
            {
                int mid = b + e >> 1;
                build(node<<1,b,mid);
                build(node<<1|1,mid+1,e);
                sTree[node] = sTree[node<<1]+sTree[node<<1|1];
            }
        }

        void update_point(int index, int val)			// O(log n)
        {
            index += N - 1;
            sTree[index] += val;
            while(index>1)
            {
                index >>= 1;
                sTree[index] = sTree[index<<1] + sTree[index<<1|1];
            }
        }

        void update_range(int i, int j, int val)		// O(log n)
        {
            update_range(1,1,N,i,j,val);
        }

        void update_range(int node, int b, int e, int i, int j, int val)
        {
            if(i > e || j < b)
                return;
            if(b >= i && e <= j)
            {
                sTree[node] += (e-b+1)*val;
                lazy[node] += val;
            }
            else
            {
                int mid = b + e >> 1;
                propagate(node, b, mid, e);
                update_range(node<<1,b,mid,i,j,val);
                update_range(node<<1|1,mid+1,e,i,j,val);
                sTree[node] = sTree[node<<1] + sTree[node<<1|1];
            }

        }
        void propagate(int node, int b, int mid, int e)
        {
            lazy[node<<1] += lazy[node];
            lazy[node<<1|1] += lazy[node];
            sTree[node<<1] += (mid-b+1)*lazy[node];
            sTree[node<<1|1] += (e-mid)*lazy[node];
            lazy[node] = 0;
        }

        int query(int i, int j)
        {
            return query(1,1,N,i,j);
        }

        int query(int node, int b, int e, int i, int j)	// O(log n)
        {
            if(i>e || j <b)
                return 0;
            if(b>= i && e <= j)
                return sTree[node];
            int mid = b + e >> 1;
            propagate(node, b, mid, e);
            int q1 = query(node<<1,b,mid,i,j);
            int q2 = query(node<<1|1,mid+1,e,i,j);
            return q1 + q2;

        }
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public int[] nextIntArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(next());
            }
            return arr;
        }

        public long[] nextLongArr(int n) throws IOException {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(next());
            }
            return arr;
        }

    }
}


import java.io.*;
import java.util.* ;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class TaskB {
    static Reader rd=new Reader() ;
    static PrintWriter out=new PrintWriter(System.out) ;

	static class Pair{
		int id, v;
		Pair(int x, int y){
			id=x;
			v=y;
		}
	}

    static class Reader
    {
        //Fast Reader class; Source GeeksForGeeks: https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/

        StringTokenizer stringTokenizer;
        BufferedReader bufferedReader;

        public Reader()
        {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements())
            {
                try
                {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (Exception e){}
            }
            return stringTokenizer.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(next());
        }

        long nl()
        {
            return Long.parseLong(next());
        }

        double nd()
        {
            return Double.parseDouble(next());
        }

        String nln()
        {
            String str = "";
            try
            {
                str = bufferedReader.readLine();
            }
            catch (Exception e) {}
            return str;
        }

        String[] ns(){
            String str="";
            try{
                str=bufferedReader.readLine();
            }catch (Exception e){
            }
            return str.trim().split("\\s+") ;
        }
    }

    static void solve(int T) throws IOException {
        while(T-->0){
			int n=rd.ni();

			int[] arr=new int[n] ;
			for(int i=0; i<n ;++i) arr[i]=rd.ni();

		//	for(int i:arr) System.out.print(i+" ") ;

			ArrayList<Pair> al=new ArrayList<Pair>();
		outer:for(int i=0; i<n; ++i){
				inner: for(int j=0; j<n; ++j){
					if(i==j) continue inner;
					else{
						if(arr[i]==arr[j]) continue outer;
					}
				}
				al.add(new Pair(i, arr[i])) ;
			}

		//	System.out.println("--=====>");
		//	for(Pair p:al) System.out.println(p.v+" "+p.id) ;

			int ai=-1, av=Integer.MAX_VALUE ;
			for(Pair p:al){
				if(p.v<av) {
					av=p.v;
					ai=p.id;
				}
			}

			out.println((ai==-1)?-1:(1+ai));
        }
    }

    static void solve(){
    }

    public static void main(String args[]) throws IOException {
        solve(rd.ni());
        out.flush();
    }
}


import java.io.*;
import java.util.* ;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class TaskB {
    static Reader rd=new Reader() ;
    static PrintWriter out=new PrintWriter(System.out) ;

	static class Pair{
		int id, v;
		Pair(int x, int y){
			id=x;
			v=y;
		}
	}

    static class Reader
    {
        //Fast Reader class; Source GeeksForGeeks: https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/

        StringTokenizer stringTokenizer;
        BufferedReader bufferedReader;

        public Reader()
        {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements())
            {
                try
                {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (Exception e){}
            }
            return stringTokenizer.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(next());
        }

        long nl()
        {
            return Long.parseLong(next());
        }

        double nd()
        {
            return Double.parseDouble(next());
        }

        String nln()
        {
            String str = "";
            try
            {
                str = bufferedReader.readLine();
            }
            catch (Exception e) {}
            return str;
        }

        String[] ns(){
            String str="";
            try{
                str=bufferedReader.readLine();
            }catch (Exception e){
            }
            return str.trim().split("\\s+") ;
        }
    }

    static void solve(int T) throws IOException {
        while(T-->0){
			int n=rd.ni();
			int[] ip =new int[n], aux=new int[n+1];
			for(int i=0; i<n; ++i){ip[i]=rd.ni(); ++aux[ip[i]];}
			int ai=-1, av=-1;
			for(int i=1; i<=n; ++i) if(aux[i]==1) {
				av=i;
				break;
			}
			for(int i=0; i<n; ++i) if(ip[i]==av) {
				ai=i;
				break;
			}

	       out.println((ai==-1)?-1:(ai+1));
        }
    }

    static void solve(){
    }

    public static void main(String args[]) throws IOException {
        solve(rd.ni());
        out.flush();
    }
}


import java.io.*;
import java.util.*;
public class p1454B{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st=new StringTokenizer("");

    public static void main(String[] args){
        StringBuilder sb=new StringBuilder();
        for(int t=nextInt();t-->0;sb.append("\n")) {
            int n=nextInt(),a[]=new int[n],b[]=new int[n+1],min=2000000,ans=-1;
            for(int i=0;i<n;i++) b[a[i]=nextInt()]++;
            for(int i=0;i<n;i++) if(a[i]<min && b[a[i]]==1) {min=a[i]; ans=i+1;}
            sb.append(ans);
        }System.out.println(sb);
    }

    static String next() {
        while (!st.hasMoreTokens())
            try {
                st=new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        return st.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }
}


public class p1454B{
    public static void main(String[] args){
        java.util.Scanner sc=new java.util.Scanner(System.in);
        StringBuilder sb=new StringBuilder();
        l: for(int t=sc.nextInt();t-->0;sb.append("\n")) {
            int n=sc.nextInt(),a[]=new int[n],b[]=new int[n+1],min=2000000;
            for(int i=0;i<n;i++) b[a[i]=sc.nextInt()]++;
            int ans=-1;
            for(int i=0;i<n;i++) if(a[i]<min && b[a[i]]==1) {sb.append(ans); continue l;} sb.append(ans);
        }System.out.println(sb);
    }
}


import java.util.Scanner;
public class p1454B{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        for(int t=sc.nextInt();t-->0;) {
            int n=sc.nextInt(),a[]=new int[n],b[]=new int[200001],min=2000000;
            for(int i=0;i<n;i++) {
                a[i]=sc.nextInt();
                b[a[i]]++;
            }int ans=-1;
            for(int i=0;i<n;i++) if(a[i]<min && b[a[i]]==1) {min=a[i]; ans=i+1;}
            System.out.println(ans);
        }
    }
}


public class p1454B{
    public static void main(String[] args){
        java.util.Scanner sc=new java.util.Scanner(System.in); //Avoiding Scanner...it's superrr slow
        StringBuilder sb=new StringBuilder();
        for(int t=sc.nextInt();t-->0;sb.append("\n")) {
            int n=sc.nextInt(),a[]=new int[n],b[]=new int[n+1],min=2000000;
            for(int i=0;i<n;i++) b[a[i]=sc.nextInt()]++;
            int ans=-1;
            for(int i=0;i<n;i++) if(a[i]<min && b[a[i]]==1) {min=a[i]; ans=i+1;}
            sb.append(ans);
        }System.out.println(sb);
    }
}


import java.util.Scanner;
public class p1454B{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        for(int t=sc.nextInt();t-->0;) {
            int n=sc.nextInt(),a[]=new int[n],b[]=new int[200000],min=2000000;
            for(int i=0;i<n;i++) {
                a[i]=sc.nextInt();
                b[a[i]]++;
            }int ans=-1;
            for(int i=0;i<n;i++) if(a[i]<min && b[a[i]]==1) {min=a[i]; ans=i+1;}
            System.out.println(ans);
        }
    }
}


import java.io.*;
import java.util.*;

public class Rock
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n;
			n = sc.nextInt();
			int a[] = new int[n];

			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();

			}
			if(n==1)
				System.out.println(1);
			else{

			int freq[] = new int[n];
			int k=0;
			for(int i=0;i<n;i++)
			{
				k=0;
				for(int j=0;j<n;j++)
				{
					if(a[j]==a[i])
						k++;
					if(k>1)
						break;

				}

				freq[i] = k;

			}

			int min=Integer.MAX_VALUE;
			int p=0;

			for(int i=0;i<n;i++)
			{
				if(freq[i]==1)
				{
					if(a[i]<min)
					{
						min = a[i];
						p = i;
					}
				}
			}
			if(p==0)
			System.out.println(-1);
			else
				System.out.println(p+1);
		}

		}
	}
}


import java.io.*;
import java.util.*;

public class Permutation
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n,j=0 ;
			n = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();
				b[i] = a[i];
			}

			Arrays.sort(b);
			int k=0;
			for(int i=0;i<n;i++)
			{
				if(i==(n-1))
					k=b[i];
				else if(b[i]!=b[i+1]){
					 k = b[i];
					 break;}
				else if(b[i]==b[i+1]){
					for( j=i+2;j<n;j++)
					{
						if(b[j]!=a[i])
							break;
					}
					i=j-1;
				}
			}
			//System.out.println("k="+k);
			if(k==0)
				System.out.println(-1);
			else
			{
				for(int i=0;i<n;i++)
				{
					if(a[i]==k)
						System.out.println(i+1);
				}
			}

		}
	}
}


import java.io.*;
import java.util.*;

public class Auction
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n;
			n = sc.nextInt();
			int a[] = new int[n];
			int freq[] = new int[n+1];
			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();
				freq[a[i]]++;

			}
			if(n==1)
				System.out.println(1);
			else{

			// int k=0;
			// for(int i=0;i<n;i++)
			// {
			// 	k=0;
			// 	for(int j=0;j<n;j++)
			// 	{
			// 		if(a[j]==a[i])
			// 			k++;
			// 		if(k>1)
			// 			break;

			// 	}

			// 	freq[i] = k;

			// }

			int min=Integer.MAX_VALUE;
			int p=-1;

			for(int i=0;i<n;i++)
			{
				if(freq[a[i]]==1)
				{
					if(a[i]<min)
					{
						//System.out.println(freq[a[i]]+" "+a[i]+" "+min);
						min = a[i];
						p = i+1;
					}
				}
			}
			if(p==-1)
				System.out.println(p);
			else
			System.out.println(p);
		}

		}
	}
}


import java.io.*;
import java.util.*;

public class Permutation
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n,j=0 ;
			n = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[n];
			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();
				b[i] = a[i];
			}

			Arrays.sort(b);
			int k=0;
			for(int i=0;i<n;i++)
			{
				if(i==(n-1))
					k=b[i];
				else if(b[i]!=b[i+1]){
					 k = b[i];
					 break;}
				else{
					for( j=i+2;j<n;j++)
					{
						if(b[j]!=a[i])
							break;
					}
					i=j-1;
				}
			}
			//System.out.println("k="+k);
			if(k==0)
				System.out.println(-1);
			else
			{
				for(int i=0;i<n;i++)
				{
					if(a[i]==k)
						System.out.println(i+1);
				}
			}

		}
	}
}


import java.io.*;
import java.util.*;

public class Auction
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n;
			n = sc.nextInt();
			int a[] = new int[n];
			int freq[] = new int[n+1];
			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();
				freq[a[i]]++;

			}
			if(n==1)
				System.out.println(1);
			else{

			// int k=0;
			// for(int i=0;i<n;i++)
			// {
			// 	k=0;
			// 	for(int j=0;j<n;j++)
			// 	{
			// 		if(a[j]==a[i])
			// 			k++;
			// 		if(k>1)
			// 			break;

			// 	}

			// 	freq[i] = k;

			// }

			int min=Integer.MAX_VALUE;
			int p=-1;

			for(int i=0;i<n;i++)
			{
				if(freq[a[i]]==1)
				{
					if(a[i]<min)
					{
						//System.out.println(freq[a[i]]+" "+a[i]+" "+min);
						min = a[i];
						p = i+1;
					}
				}
			}
			if(p==-1)
				System.out.println(p);
			else
			System.out.println(p);
		}

		}
	}
}

import java.io.*;
import java.util.*;

public class Auction
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int t;
		t = sc.nextInt();
		while(t!=0)
		{
			t--;
			int n;
			n = sc.nextInt();
			int a[] = new int[n];
			int freq[] = new int[n+1];
			for(int i=0;i<n;i++)
			{
				a[i] = sc.nextInt();
				freq[a[i]]++;

			}
			if(n==1)
				System.out.println(1);
			else{

			// int k=0;
			// for(int i=0;i<n;i++)
			// {
			// 	k=0;
			// 	for(int j=0;j<n;j++)
			// 	{
			// 		if(a[j]==a[i])
			// 			k++;
			// 		if(k>1)
			// 			break;

			// 	}

			// 	freq[i] = k;

			// }

			int min=Integer.MAX_VALUE;
			int p=-1;

			for(int i=0;i<n;i++)
			{
				if(freq[a[i]]==1)
				{
					if(a[i]<min)
					{
						//System.out.println(freq[a[i]]+" "+a[i]+" "+min);
						min = a[i];
						p = i+1;
					}
				}
			}
			if(p==-1)
				System.out.println(p);
			else
			System.out.println(p);
		}

		}
	}
}


import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0)
        {
            int n=Integer.parseInt(br.readLine());
            String data[]=br.readLine().split(" ");
            Map<Integer,Integer>hm=new HashMap<>();
            int a[]=new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]=Integer.parseInt(data[i]);
                hm.put(a[i],hm.getOrDefault(a[i],0)+1);
            }
            int min=-1;
            for(var m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1)
                {
                    min=m.getKey();
                }
            }
            for(var m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1&&m.getKey()<min)
                {
                    min=m.getKey();
                }
            }

            System.out.println(min);
        }

    }
}


import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0)
        {
            int n=Integer.parseInt(br.readLine());
            String data[]=br.readLine().split(" ");
            Map<Integer,Integer>hm=new HashMap<>();
            int a[]=new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]=Integer.parseInt(data[i]);
                hm.put(a[i],hm.getOrDefault(a[i],0)+1);
            }
            int min=-1;
            for(Map.Entry<Integer,Integer> m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1)
                {
                    min=m.getKey();
                }
            }
            for(Map.Entry<Integer,Integer> m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1&&m.getKey()<min)
                {
                    min=m.getKey();
                }
            }

            System.out.println(min);
        }

    }
}


import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0)
        {
            int n=Integer.parseInt(br.readLine());
            String data[]=br.readLine().split(" ");
            Map<Integer,Integer>hm=new HashMap<>();
            ArrayList<Integer>a=new ArrayList<>();
            for(int i=0;i<n;i++)
            {
                a.add(Integer.parseInt(data[i]));
                hm.put(a.get(i),hm.getOrDefault(a.get(i),0)+1);
            }
            int min=-1;
            for(Map.Entry<Integer,Integer> m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1)
                {
                    min=m.getKey();
                }
            }
            for(Map.Entry<Integer,Integer> m:hm.entrySet())
            {
                // System.out.println(m.getKey()+" "+m.getValue());
                if(m.getValue()==1&&m.getKey()<min)
                {
                    min=m.getKey();
                }
            }
            if(min==-1){System.out.println(-1+"");continue;}
            System.out.println(a.indexOf(min)+1);
        }

    }
}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class GG2 {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            TreeMap<Integer,ArrayList<Integer>> tm=new TreeMap<>();
            for(int i=0;i<n;i++){
                int num=scan.nextInt();
                tm.putIfAbsent(num,new ArrayList<>());
                tm.get(num).add(i+1);
            }
            for(Integer i:tm.keySet()){
                if(tm.get(i).size()==1){
                    out.println(tm.get(i).get(0));
                    break;
                }
            }
        }
        out.flush();
        out.close();
    }
    static class pair implements Comparable<pair>{
        int x;
        int y;
        pair(int x,int y){
            this.x=x;
            this.y=y;
        }

        @Override
        public int compareTo(pair o) {
            return this.x-o.x;
        }
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class GG2 {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            TreeMap<Integer,ArrayList<Integer>> tm=new TreeMap<>();
            for(int i=0;i<n;i++){
                int num=scan.nextInt();
                tm.putIfAbsent(num,new ArrayList<>());
                tm.get(num).add(i+1);
            }
            boolean flag=true;
            for(Integer i:tm.keySet()){
                if(tm.get(i).size()==1){
                    out.println(tm.get(i).get(0));
                    flag=false;
                    break;
                }
            }
            if(flag){
                out.println(-1);
            }
        }
        out.flush();
        out.close();
    }
    static class pair implements Comparable<pair>{
        int x;
        int y;
        pair(int x,int y){
            this.x=x;
            this.y=y;
        }

        @Override
        public int compareTo(pair o) {
            return this.x-o.x;
        }
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class GG2 {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            pair[] arr=new pair[n];
            for(int i=0;i<n;i++){
                arr[i]=new pair(scan.nextInt(),i);
            }
            if(n==1){
                out.println(1);
            }else{
                if(arr[0].x==arr[1].x){
                    out.println(-1);
                }else{
                    out.println(arr[0].y);
                }
            }
        }
        out.flush();
        out.close();
    }
    static class pair implements Comparable<pair>{
        int x;
        int y;
        pair(int x,int y){
            this.x=x;
            this.y=y;
        }

        @Override
        public int compareTo(pair o) {
            return this.x-o.x;
        }
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


import java.util.Scanner;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) {
      // Write your solution here
      Scanner scanner = new Scanner(System.in);
      int t = Integer.parseInt(scanner.nextLine());
      while (t-- > 0) {
         int n = scanner.nextInt();
         int[] arr = new int[n];
         for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
         }
         int[] dp = new int[(int) (2e5 +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1, min = Integer.MAX_VALUE;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 && arr[i] < min){
               ans = i + 1 ;
               min = arr[i];

            }
         }

         System.out.println(ans);
      }
   }
}


import java.util.Scanner;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) {
      // Write your solution here
      Scanner scanner = new Scanner(System.in);
      int t = Integer.parseInt(scanner.nextLine());
      while (t-- > 0) {
         int n = scanner.nextInt();
         int[] arr = new int[n];
         for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
         }
         int[] dp = new int[(int) (2e5 +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 ){
               ans = i + 1 ;
               break;
            }
         }

         System.out.println(ans);
      }
   }
}


import java.util.Scanner;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) {
      // Write your solution here
      Scanner scanner = new Scanner(System.in);
      int t = Integer.parseInt(scanner.nextLine());
      while (t-- > 0) {
         int n = scanner.nextInt();
         int[] arr = new int[n];
         for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
         }
         int[] dp = new int[(int) (1e5 +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1, min = Integer.MAX_VALUE;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 && arr[i] < min){
               ans = i + 1 ;
               min = arr[i];

            }
         }

         System.out.println(ans);
      }
   }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) throws IOException {
      // Write your solution here
      //Scanner scanner = new Scanner(System.in);
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int t = Integer.parseInt(br.readLine());
      while (t-- > 0) {
         int n = Integer.parseInt(br.readLine());
         int[] arr = new int[n];
         String[] temp = br.readLine().split(" ");
         for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(temp[i]);
         }
         int[] dp = new int[(int) (2e5 +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1, min = Integer.MAX_VALUE;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 && arr[i] < min){
               ans = i + 1 ;
               min = arr[i];

            }
         }

         System.out.println(ans);
      }
   }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) throws IOException {
      // Write your solution here
      //Scanner scanner = new Scanner(System.in);
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int t = Integer.parseInt(br.readLine());
      while (t-- > 0) {
         int n = Integer.parseInt(br.readLine());
         //int[] arr = new int[n];
         int[] arr = Arrays.stream(br.readLine().split("\\s+")).mapToInt(Integer::valueOf).toArray();
//         for (int i = 0; i < n; i++) {
//            arr[i] = scanner.nextInt();
//         }
         int[] dp = new int[(int) (2e5 +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1, min = Integer.MAX_VALUE;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 && arr[i] < min){
               ans = i + 1 ;
               min = arr[i];

            }
         }

         System.out.println(ans);
      }
   }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 */

public class Main {
   public static void main(String[] args) throws IOException {
      // Write your solution here
      //Scanner scanner = new Scanner(System.in);
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int t = Integer.parseInt(br.readLine());
      while (t-- > 0) {
         int n = Integer.parseInt(br.readLine());
         int[] arr = new int[n];
         String[] temp = br.readLine().split(" ");
         for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(temp[i]);
         }
         int[] dp = new int[(n +1)];
         for (int i = 0; i < n; i++) {
            dp[arr[i]]++;
         }
         int ans = -1, min = Integer.MAX_VALUE;
         for (int i = 0; i < n; i++) {
            if(dp[arr[i]] == 1 && arr[i] < min){
               ans = i + 1 ;
               min = arr[i];
            }
         }

         System.out.println(ans);
      }
   }
}


import java.math.BigInteger;
import java.util.*;

public class M {
	static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		int n=sc.nextInt();
		for(int i=0;i<n;i++) {
			show();
		}
	}
	private static void show() {
		int n=sc.nextInt();

		int a[][]=new int [n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=i;
			a[i][1]=sc.nextInt();
		}
		if(n==1) {
			System.out.println(1);
			return;
		}
		Arrays.sort(a,new Comparator<int []>() {

			@Override
			public int compare(int[] a, int[] b) {
				return a[1]-b[1];
			}

		});
//		for(int i=0;i<n;i++) {
//			System.out.println(Arrays.toString(a[i]));
//		}
		if(a[0][1]!=a[1][1]) {
			System.out.println(a[0][0]+1);
			return;
		}
		for(int i=1;i<n-1;i++) {
			if(a[i][1]!=a[i+1][1]&&a[i-1][1]!=a[i][1]) {
				System.out.println(a[i][0]+1);
				return;
			}
		}
		if(a[n-1][1]!=a[n-2][1]) {
			System.out.println(a[n-1][0]+1);
		}else {
			System.out.println(-1);
		}
	}
}


import java.math.BigInteger;
import java.util.*;

public class Main {
	static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		int n=sc.nextInt();
		for(int i=0;i<n;i++) {
			show();
		}
	}
	private static void show() {
		int n=sc.nextInt();

		int a[][]=new int [n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=i;
			a[i][1]=sc.nextInt();
		}
		if(n==1) {
			System.out.println(1);
			return;
		}
		Arrays.sort(a,new Comparator<int []>() {

			@Override
			public int compare(int[] a, int[] b) {
				return a[1]-b[1];
			}

		});
//		for(int i=0;i<n;i++) {
//			System.out.println(Arrays.toString(a[i]));
//		}
		if(a[0][1]!=a[1][1]) {
			System.out.println(a[0][0]+1);
			return;
		}
		for(int i=1;i<n-1;i++) {
			if(a[i][1]!=a[i+1][1]&&a[i-1][1]!=a[i][1]) {
				System.out.println(a[i][0]+1);
				return;
			}else {
				i+=2;
			}
		}
		if(a[n-1][1]!=a[n-2][1]) {
			System.out.println(a[n-1][0]+1);
		}else {
			System.out.println(-1);
		}
	}
}


import java.util.Scanner;

public class UniqueBitAuction {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int t=input.nextInt();

		for(int i=0;i<t;i++) {
				int x = input.nextInt();
				int[] ar = new int[x];
				int[] count = new int[x+200];
				int best =-1;
				for(int k=0;k<x;k++) {
					ar[k] = input.nextInt();
				}
				for(int e:ar) {
					count[e]++;
				}
				for(int k=0;k<x;k++) {
					if(count[ar[k]] ==1 && (best == -1 || ar[best]>ar[k])) {
						best = k;
					}
				}
				sb.append(best ==-1?-1:best+1).append("\n");

		}
		System.out.println(sb.toString());
		input.close();

	}

}


package com.smarterviews.codeforces.contest;

import java.util.Scanner;

public class UniqueBitAuction {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int t=input.nextInt();

		for(int i=0;i<t;i++) {
				int x = input.nextInt();
				int[] ar = new int[x];
				int[] count = new int[x+200];
				int best =-1;
				for(int k=0;k<x;k++) {
					ar[k] = input.nextInt();
				}
				for(int e:ar) {
					count[e]++;
				}
				for(int k=0;k<x;k++) {
					if(count[ar[k]] ==1 && (best == -1 || ar[best]>ar[k])) {
						best = k;
					}
				}
				sb.append(best ==-1?-1:best+1).append("\n");

		}
		System.out.println(sb.toString());
		input.close();

	}

}


import java.util.*;

public class CodeForces683_2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int testCases = in.nextInt();
        for (int eachTest = 0; eachTest < testCases; eachTest++) {
            int size = in.nextInt();
            int min = Integer.MAX_VALUE;
            boolean flag = false;
            TreeMap<Integer,Integer> map = new TreeMap<>();
            for (int i = 0; i < size; i++) {
                int value = in.nextInt();
                map.put(value, map.getOrDefault(value, 0) + 1);
            }

            for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
                if (entry.getValue().equals(1)) {
                    System.out.println(entry.getKey());
                    flag = true;
                    break;
                }
            }

            if (!flag) {
                System.out.println(-1);
            }
        }
    }
}


import java.util.*;

public class CodeForces683_2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int testCases = in.nextInt();
        for (int eachTest = 0; eachTest < testCases; eachTest++) {
            int size = in.nextInt();
            int min = Integer.MAX_VALUE;
            int arr[] = new int[size];
            boolean flag = false;
            TreeMap<Integer,Integer> map = new TreeMap<>();
            for (int i = 0; i < size; i++) {
                int value = in.nextInt();
                arr[i] = value;
                map.put(value, map.getOrDefault(value, 0) + 1);
            }

            int val = -1;
            for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
                if (entry.getValue().equals(1)) {
                    val = entry.getKey();
                    flag = true;
                    break;
                }
            }

            if (!flag) {
                System.out.println(-1);
            } else {
                for (int i = 0; i < size; i++) {
                    if (val == arr[i]) {
                        System.out.println(i + 1);
                        break;
                    }
                }
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			List<Integer> l = new ArrayList<>();
			List<Integer> l1 = new ArrayList<>();
			int[] se = new int[1000000];
			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				if(se[ar[i]]==0)l.add(ar[i]);
				se[ar[i]]++;
			}
			Collections.sort(l);
			int f=0,k=0;
			for(int i=0;i<n && k<l.size();i++) {

//				System.out.println("l "+l.get(k));
				if(se[l.get(k)]>1) {
					k++;
//					System.out.println(l.get(k)+" "+se[l.get(k)]);
					continue;
				}
				else if(ar[i]==l.get(k)&&se[ar[i]]==1) {
					System.out.println(i+1);
					f=1;
					break;
				}
			}
			if(f==0)System.out.println(-1);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			int[] ar1 = new int[1000000];
			int[] se = new int[1000000];

			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				se[ar[i]]++;
				ar1[ar[i]]=i+1;
			}
			int o=-1;
			for(int i=0;i<=n;i++) {
//				System.out.println(i);
				if(se[i]==1) {
					o=ar1[i];
					break;
				}
			}
			if(o<0)System.out.println(o);
			else System.out.println(o);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			int[] ar1 = new int[1000000];
			int[] se = new int[1000000];
			ArrayList<Integer>
            l = new ArrayList<Integer>();

			Map<Integer,Integer> m= new HashMap<Integer,Integer>();
			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				if(!m.containsKey(ar[i])){

					m.put(ar[i],1);
//					System.out.println(m.get(ar[i]+" "+ar[i]));
				}
				else m.put(ar[i],m.get(ar[i])+1);
//				System.out.println(m);
			}
			int o=-1;
			for(int i=0;i<n;i++) {
//				System.out.println(i);
				if(m.get(ar[i])==1 && (o<0 || ar[i]<ar[o])) {
					o=i;
				}
			}
			if(o<0)System.out.println(o);
			else System.out.println(o+1);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			int[] ar1 = new int[1000000];
			int[] se = new int[1000000];
			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				ar1[ar[i]]=i+1;
				se[ar[i]]++;
			}
			Arrays.sort(ar);
			int f=0;
			for(int i=0;i<n;i++) {
				if(se[ar[i]]==1) {
					System.out.println((ar1[ar[i]]));
					f=1;
					break;
				}
			}
			if(f==0)System.out.println(-1);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int N = s.nextInt();
			int[] Arr = new int[N];
			int[] Person = new int[N];
			int Min = 0;

			for(int j=0;j<N;j++)
			{
				int a = s.nextInt();
				Person[a-1] = j+1;
				Arr[a-1]++;
			}
			for(int j=0;j<N;j++)
			{
				if(Arr[j]==1)
				{
					Min=Person[j];
					break;
				}
			}
			if(Min>0)System.out.println(Min);
			else System.out.println(-1);
//			int n = s.nextInt();
//			int[] ar = new int[n];
//			int[] ar1 = new int[1000000];
//			int[] se = new int[1000000];
//
//
//
//			for(int i=0;i<n;i++) {
//				ar[i]=s.nextInt();
//				se[ar[i]-1]++;
//				ar1[ar[i]-1]=i+1;
//			}
//			int o=-1;
//			for(int i=0;i<n;i++) {
////				System.out.println(i);
//				if(se[i]==1) {
//					o=ar1[i];
//					break;
//				}
//			}
//			System.out.println(o);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			int[] ar1 = new int[1000000];
			int[] se = new int[1000000];

			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				se[ar[i]-1]++;
				ar1[ar[i]-1]=i+1;
			}
			int o=-1;
			for(int i=0;i<=n;i++) {
//				System.out.println(i);
				if(se[i]==1) {
					o=ar1[i];
					break;
				}
			}
			System.out.println(o);

		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	   static class FastReader
	    {
       BufferedReader br;
       StringTokenizer st;

       public FastReader()
       {
           br = new BufferedReader(new
                    InputStreamReader(System.in));
       }

       String next()
       {
           while (st == null || !st.hasMoreTokens())
           {
               try
               {
                   st = new StringTokenizer(br.readLine());
               }
               catch (IOException  e)
               {
                   e.printStackTrace();
               }
           }
           return st.nextToken();

       }

       int nextInt()
       {
           return Integer.parseInt(next());
       }

       long nextLong()
       {
           return Long.parseLong(next());
       }

       double nextDouble()
       {
           return Double.parseDouble(next());
       }

       String nextLine()
       {
           String str = "";
           try
           {
               str = br.readLine();
           }
           catch (IOException e)
           {
               e.printStackTrace();
           }
           return str;
       }

		public Character charAt(int i) {
			// TODO Auto-generated method stub
			return null;
		}

		public BigInteger nextBigInteger() {
			// TODO Auto-generated method stub
			return null;
		}
   }
	   static Map<Integer,Integer> ar = new HashMap<>();
	   static boolean[] v = new boolean[100005];
	   static void dfs(int i) {
		   if(!v[i]) {
			   v[i]=true;
			   for(int a: ar.values()) {
				   dfs(a);
			   }
		   }
	   }
//		int r1 =s.nextInt();
//		int c1 =s.nextInt();
//		int r2 =s.nextInt();
//		int c2 =s.nextInt();
//		if(r1==c1&&c1==c2 && c2==r2)System.out.println(0);
//		else if(r1==c1&&r2==c2)System.out.println(1);
//		else if(r1==c1)System.out.println(2);
//		else {
//			if(r1+c1==c2+r2)System.out.println(1);
//			else if(r1-c1==r2-c2)System.out.println(1);
//			else if(Math.abs(r1-r1)+Math.abs(c1-c2)<3 || Math.abs(r1-r1)+Math.abs(c1-c2)==3 )System.out.println(1);
//			else System.out.println(3);
//		}
//		int a  =s.nextInt();
//		int b  =s.nextInt();
//		int c  =s.nextInt();
//
//		double a1 =((double)a/(double)(a+b+c));
////		System.out.println(a1);
//		double b1 =((double)b/(double)(a+b+c));
//		double c1 =((double)c/(double)(a+b+c));
//		System.out.println((double)(100-a)*(a1)+(100-b)*b1+(100-c)*c1);
	public static void main(String[] args) {
		FastReader s=new FastReader();
		int t = s.nextInt();
		while(t-->0) {
			int n = s.nextInt();
			int[] ar = new int[n];
			int[] ar1 = new int[n];
			int[] se = new int[n];

			for(int i=0;i<n;i++) {
				ar[i]=s.nextInt();
				se[ar[i]-1]++;
				ar1[ar[i]-1]=i+1;
			}
			int o=-1;
			for(int i=0;i<n;i++) {
//				System.out.println(i);
				if(se[i]==1) {
					o=ar1[i];
					break;
				}
			}
			System.out.println(o);

		}

	}

}


import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        // TreeNode root = new TreeNode(4,
        // new TreeNode(1, new TreeNode(0, null, null), new TreeNode(2, null, new
        // TreeNode(3))),
        // new TreeNode(6, new TreeNode(5, null, null), new TreeNode(7, null, new
        // TreeNode(8, null, null))));
        Scanner scan = new Scanner(System.in);

        // CodeForces
        int t = scan.nextInt();
        for (int i = 0; i < t; i++) {
            int n = scan.nextInt();
            HashMap<Integer, Integer> map = new HashMap();
            for (int j = 0; j < n; j++) {
                int num = scan.nextInt();
                if (map.containsKey(num)) {
                    map.put(num, -1);
                } else {
                    map.put(num, j+1);
                }
            }
            Boolean temp = true;
            for (Integer num : map.keySet()) {
                if (map.get(num) != -1) {
                    temp = false;
                    System.out.println(map.get(num));
                    break;
                }
            }
            if(temp) System.out.println(-1);
        }

        // GOOGLE
        /*
         * int T = scan.nextInt(); for (int i = 1; i <= T; i++) { int count = 0; int N =
         * scan.nextInt(); int K = scan.nextInt(); int temp = 0; for (int j = 0; j < N;
         * j++) { int s = scan.nextInt(); int e = scan.nextInt(); if (j == 0) { double t
         * = (e-s)/(double)K; count += Math.ceil(t); } else { if (e > temp) { if (s >
         * temp) { count += Math.ceil((e - s) / (double)K); } else if (s <= temp) {
         * count += Math.ceil((e - temp) /(double) K); } } } temp = s + K; }
         * System.out.println("Case #"+i+": "+count); }
         */
    }
}
// Definition for a binary tree node.
/*
 * class TreeNode { int val; TreeNode left; TreeNode right;
 *
 * TreeNode() { }
 *
 * TreeNode(int val) { this.val = val; }
 *
 * TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left
 * = left; this.right = right; } }
 */


import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        // TreeNode root = new TreeNode(4,
        // new TreeNode(1, new TreeNode(0, null, null), new TreeNode(2, null, new
        // TreeNode(3))),
        // new TreeNode(6, new TreeNode(5, null, null), new TreeNode(7, null, new
        // TreeNode(8, null, null))));
        Scanner scan = new Scanner(System.in);

        // CodeForces
        int t = scan.nextInt();
        for (int i = 0; i < t; i++) {
            int n = scan.nextInt();
            HashMap<Integer, Integer[]> map = new HashMap();
            for (int j = 0; j < n; j++) {
                int num = scan.nextInt();
                if (map.containsKey(num)) {
                    Integer temp[] = map.get(num);
                    temp[1]=-1;
                    temp[0]=-1;
                    map.put(num, temp);
                } else {
                    map.put(num, new Integer[]{j+1,1});
                }
            }
            Boolean temp = true;
            for (Integer num : map.keySet()) {
                if (map.get(num)[1] == 1) {
                    temp = false;
                    System.out.println(map.get(num)[0]);
                    break;
                }
            }
            if(temp) System.out.println(-1);
        }

        // GOOGLE
        /*
         * int T = scan.nextInt(); for (int i = 1; i <= T; i++) { int count = 0; int N =
         * scan.nextInt(); int K = scan.nextInt(); int temp = 0; for (int j = 0; j < N;
         * j++) { int s = scan.nextInt(); int e = scan.nextInt(); if (j == 0) { double t
         * = (e-s)/(double)K; count += Math.ceil(t); } else { if (e > temp) { if (s >
         * temp) { count += Math.ceil((e - s) / (double)K); } else if (s <= temp) {
         * count += Math.ceil((e - temp) /(double) K); } } } temp = s + K; }
         * System.out.println("Case #"+i+": "+count); }
         */
    }
}
// Definition for a binary tree node.
/*
 * class TreeNode { int val; TreeNode left; TreeNode right;
 *
 * TreeNode() { }
 *
 * TreeNode(int val) { this.val = val; }
 *
 * TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left
 * = left; this.right = right; } }
 */


import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Solution {
    public static void main(String[] args) {
        // TreeNode root = new TreeNode(4,
        // new TreeNode(1, new TreeNode(0, null, null), new TreeNode(2, null, new
        // TreeNode(3))),
        // new TreeNode(6, new TreeNode(5, null, null), new TreeNode(7, null, new
        // TreeNode(8, null, null))));
        Scanner scan = new Scanner(System.in);

        // CodeForces
        int t = scan.nextInt();
        for (int i = 0; i < t; i++) {
            int n = scan.nextInt();
            int ar[]=new int[n+1];
            for (int j = 0; j < n; j++) {
                int num = scan.nextInt();
                // if (map.containsKey(num)) {
                //     map.put(num, -1);
                // } else {
                //     map.put(num, j+1);
                // }
                // set.add(num);
                if(ar[num]!=0){
                   ar[num]=-1;
                }else
                ar[num]=j+1;
            }
            // System.out.println(Arrays.toString(ar));
            Boolean temp = true;
            for (Integer num :ar) {
                if (num >= 1 ) {
                    temp = false;
                    System.out.println(num);
                    break;
                }
            }
            if(temp) System.out.println(-1);
        }

        // GOOGLE
        /*
         * int T = scan.nextInt(); for (int i = 1; i <= T; i++) { int count = 0; int N =
         * scan.nextInt(); int K = scan.nextInt(); int temp = 0; for (int j = 0; j < N;
         * j++) { int s = scan.nextInt(); int e = scan.nextInt(); if (j == 0) { double t
         * = (e-s)/(double)K; count += Math.ceil(t); } else { if (e > temp) { if (s >
         * temp) { count += Math.ceil((e - s) / (double)K); } else if (s <= temp) {
         * count += Math.ceil((e - temp) /(double) K); } } } temp = s + K; }
         * System.out.println("Case #"+i+": "+count); }
         */
    }
}
// Definition for a binary tree node.
/*
 * class TreeNode { int val; TreeNode left; TreeNode right;
 *
 * TreeNode() { }
 *
 * TreeNode(int val) { this.val = val; }
 *
 * TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left
 * = left; this.right = right; } }
 */


import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.List;

public class Main{
     public static void main(String[] args) {
        FastScanner sc = new FastScanner();
//        Scanner sc= new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t=sc.nextInt();
        while (t-->=1) {
            int n = sc.nextInt();
            int a[]=sc.readArray(n);
//            sort(a);
            int fre[]= new int[n+100];
            for (int i=0;i<n;i++){
                fre[a[i]]++;
            }
            HashMap<Integer,Integer> map = new HashMap<>();
            for (int i=0;i<n;i++){
                map.put(a[i],i+1);
            }
            int index=Integer.MAX_VALUE;
            loop:for (int i=0;i<fre.length;i++){
                if (fre[i]==1){
                    index=map.get(i);
                    break loop;
                }
            }
            System.out.println(index==Integer.MAX_VALUE?-1:index);

//            System.out.println(map);

        }

        out.flush();

    }
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static String sortString(String s){
        char temp[]=s.toCharArray();
        Arrays.sort(temp);
        return new String(temp);
    }

    static class Pair implements Comparable<Pair> {
        int num, val;

        public Pair(int a, int b) {
            num = a;
            val = b;
        }

        public int compareTo(Pair x) {
            return x.val-val;
        }
    }
    static int mod=(int)1e9+7;
    static long mod(long x){
        return ((x%mod+mod)%mod);
    }
    static long add(long x,long y){
        return mod(mod(x)+mod(y));
    }
    static long mul(long x,long y){
        return mod(mod(x)*mod(y));
    }
    static int[] find(int n,int start,int diff){
        int a[]= new int[n];
        a[0]=start;
        for (int i=1;i<n;i++)a[i]=a[i-1]+diff;
        return a;
    }
    static void swap(int a,int b){
        int c=a;
        a=b;
        b=c;
    }

    static void printArray(int a[]){
        for (int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }
    }
    static boolean sorted(int a[]){
        int n=a.length;
        boolean flag=true;
        for (int i=0;i<n-1;i++){
            if (a[i]>a[i+1])flag=false;
        }
        if (flag)return true;
        else  return false;
    }
    public static int findlog(long n){
        if(n == 0)
            return 0;

        if(n == 1)
            return 0;
        if(n == 2)
            return 1;
        double num = Math.log(n);
        double den = Math.log(2);
        if(den == 0)
            return 0;
        return (int)(num/den);
    }
    public static long gcd(long a,long b){
        if(b%a == 0)
            return a;
        return gcd(b%a,a);
    }
    public static int gcdInt(int a,int b){

        if(b%a == 0)
            return a;

        return gcdInt(b%a,a);

    }

    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long[] readArrayLong(long n) {
            long[] a=new long[(int)n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.List;

public class Main{
     public static void main(String[] args) {
        FastScanner sc = new FastScanner();
//        Scanner sc= new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t=sc.nextInt();
        while (t-->=1) {
            int n = sc.nextInt();
            int a[]=sc.readArray(n);
//            sort(a);
            int fre[]= new int[(int)(2*(1e5))];
            for (int i=0;i<n;i++){
                fre[a[i]]++;
            }
            HashMap<Integer,Integer> map = new HashMap<>();
            for (int i=0;i<n;i++){
                map.put(a[i],i+1);
            }
            int index=Integer.MAX_VALUE;
            loop:for (int i=0;i<fre.length;i++){
                if (fre[i]==1){
                    index=map.get(i);
                    break loop;
                }
            }
            System.out.println(index==Integer.MAX_VALUE?-1:index);

//            System.out.println(map);

        }

        out.flush();

    }
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static String sortString(String s){
        char temp[]=s.toCharArray();
        Arrays.sort(temp);
        return new String(temp);
    }

    static class Pair implements Comparable<Pair> {
        int num, val;

        public Pair(int a, int b) {
            num = a;
            val = b;
        }

        public int compareTo(Pair x) {
            return x.val-val;
        }
    }
    static int mod=(int)1e9+7;
    static long mod(long x){
        return ((x%mod+mod)%mod);
    }
    static long add(long x,long y){
        return mod(mod(x)+mod(y));
    }
    static long mul(long x,long y){
        return mod(mod(x)*mod(y));
    }
    static int[] find(int n,int start,int diff){
        int a[]= new int[n];
        a[0]=start;
        for (int i=1;i<n;i++)a[i]=a[i-1]+diff;
        return a;
    }
    static void swap(int a,int b){
        int c=a;
        a=b;
        b=c;
    }

    static void printArray(int a[]){
        for (int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }
    }
    static boolean sorted(int a[]){
        int n=a.length;
        boolean flag=true;
        for (int i=0;i<n-1;i++){
            if (a[i]>a[i+1])flag=false;
        }
        if (flag)return true;
        else  return false;
    }
    public static int findlog(long n){
        if(n == 0)
            return 0;

        if(n == 1)
            return 0;
        if(n == 2)
            return 1;
        double num = Math.log(n);
        double den = Math.log(2);
        if(den == 0)
            return 0;
        return (int)(num/den);
    }
    public static long gcd(long a,long b){
        if(b%a == 0)
            return a;
        return gcd(b%a,a);
    }
    public static int gcdInt(int a,int b){

        if(b%a == 0)
            return a;

        return gcdInt(b%a,a);

    }

    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long[] readArrayLong(long n) {
            long[] a=new long[(int)n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }

}


//package Competition;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) {
		int T = scn.nextInt();

		for (int t = 0; t < T; t++) {
			int n = scn.nextInt();
			int a[] = new int[n];
			int b[] = new int[n];

			for (int i = 0; i < n; i++) {
				a[i] = scn.nextInt();
				b[i] = a[i];
			}

			Arrays.sort(b);

			if(n == 1) {
				System.out.println(1);
				continue;
			}

			int x = 1;
			int min = 0;

			for (int i = 1; i <= n; i++) {

				if (i<n && b[i] == b[i - 1]) {
					x++;
				} else if (x == 1) {
					min = b[i-1];
					break;
				} else if (x != 1) {
					x = 1;
				}
			}

			if (min == 0) {
				System.out.println(-1);
			} else {
				for (int i = 0; i < n; i++) {
					if (a[i] == min) {
						System.out.println(i + 1);
						break;
					}
				}
			}

		}

	}

}


//package Competition;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static Scanner scn = new Scanner(System.in);
	static int x = 0;

	public static void main(String[] args) {
		int T = scn.nextInt();

		for (int t = 0; t < T; t++) {
		    x = 0;
			int n = scn.nextInt();
			int a[] = new int[n];
			int b[] = new int[n];

			for (int i = 0; i < n; i++) {
				a[i] = scn.nextInt();
				b[a[i] - 1]++;
			}

			arr(b, 0, n - 1);

			if (x == 0) {
				System.out.println(-1);
			} else {
				arr2(a, 0, n - 1);
			}

		}

	}

	public static boolean arr(int[] a, int lo, int hi) {
		if (lo == hi) {
			if (a[lo] == 1) {
				x = lo+1;
				return true;
			}
			return false;
		}

		int mid = (lo + hi) / 2;

		if (arr(a, lo, mid)) {
			return true;
		}
		if (arr(a, mid + 1, hi)) {
			return true;
		}

		return false;
	}

	public static boolean arr2(int[] a, int lo, int hi) {
		if (lo == hi) {
			if (a[lo] == x) {
				System.out.println(lo + 1);
				return true;
			}
			return false;
		}

		int mid = (lo + hi) / 2;

		if (arr2(a, lo, mid)) {
			return true;
		}
		if (arr2(a, mid + 1, hi)) {
			return true;
		}

		return false;
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Main1 solver = new Main1();
        solver.solve(1, in, out);
        out.close();
    }

    public static class Main1{

        public void solve(int testNumber, FastReader s, PrintWriter out) {
		    int t=s.nextInt();
		    while(t-->0){
		        int n=s.nextInt();
		        int[] arr=new int[n];
		        int flag=0;
		        HashMap<Integer, Integer> hm=new HashMap<>();
		        for(int i=0;i<n;i++){
		            int a=s.nextInt();
		            arr[i]=a;
		            if(hm.containsKey(a)) hm.put(a, hm.get(a)+1);
		            else hm.put(a, 1);
		        }
		        int z=0;
		        for(Map.Entry mp : hm.entrySet()){
		            int key=(int)mp.getKey();
		            int value=(int)mp.getValue();
		            if(value==1) {flag=1; z=key; break;}
		        }
		        if(flag==1){
		            for(int i=0;i<n;i++) if(z==arr[i]) out.println(i+1);
		        }
		        else out.println(-1);

		    }

		out.close();
        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Main1 solver = new Main1();
        solver.solve(1, in, out);
        out.close();
    }

    public static class Main1{

        public void solve(int testNumber, FastReader s, PrintWriter out) {
		    int t=s.nextInt();
		    while(t-->0){
		        int n=s.nextInt();
		        int[] arr=new int[n];
		        int flag=0;
		        TreeMap<Integer, Integer> hm=new TreeMap<>();
		        for(int i=0;i<n;i++){
		            int a=s.nextInt();
		            arr[i]=a;
		            if(hm.containsKey(a)) hm.put(a, hm.get(a)+1);
		            else hm.put(a, 1);
		        }
		        out.println(hm);
		        int z=0;
		        for(Map.Entry mp : hm.entrySet()){
		            int key=(int)mp.getKey();
		            int value=(int)mp.getValue();
		            if(value==1) {flag=1; z=key; break;}
		        }
		        if(flag==1){
		            for(int i=0;i<n;i++) if(z==arr[i]) out.println(i+1);
		        }
		        else out.println(-1);

		    }

		out.close();
        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}