import java.util.*;
public class D2N1 {
	public static void main(String[]args) {
		Scanner sc= new Scanner(System.in);
		int people= sc.nextInt();
		int first=sc.nextInt();
		int sec=sc.nextInt();
boolean notrated= true;
boolean rated= true;

		for (int i=1; i<people;i++) {
			if (first!=sec) {
		notrated=false;
		}
			int f= sc.nextInt();
			int s= sc.nextInt();
			if (f!=s) {
				notrated= false;
				System.out.println("rated");
				break;
			}
			else {
				if ( first<f || sec<s) {
	rated=false;
	System.out.println("unrated");
	break;}
			}
	first=f;
		sec=s;
	if ((i==people-1)&&(notrated=true)&&(rated=true))
			{
			System.out.println("maybe");
	}
		}
	}

}


import java.util.*;
public class D2N1 {
	public static void main(String[]args) {
		rated();}

		public static void rated() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int[][]a= new int[n][2];
		boolean rated= false;
		boolean notrated= false;
		for (int i=0; i<n;i++) {
			for (int j=0; j<2;j++) {
				a[i][j]= sc.nextInt();
}
		}
		for (int k=0;k<n;k++) {
			if(a[k][0]!=a[k][1]) {
				System.out.println("rated");
				rated=true;
return;
			}

		}
		for (int m=0;m<n-1;m++) {
			if( (a[m][0]<a[m=1][0]) ||(a[m][1]< a[m+1][1]))
		System.out.println("unrated");
			notrated=true;
			return;
			}

		for (int z=0;z<n;z++) {
			if ((z==n-1)&&(rated)&&(notrated)) {
				System.out.println("maybe");
				return;
			}
		}

	}
}


import java.util.*;
public class D2N1 {
	public static void main(String[]args) {
		rated();}

		public static void rated() {
		Scanner sc= new Scanner(System.in);
		int n= sc.nextInt();
		int[][]a= new int[n][2];
		boolean rated= false;
		boolean notrated= false;
		for (int i=0; i<n;i++) {
			for (int j=0; j<2;j++) {
				a[i][j]= sc.nextInt();
}
		}
		for (int k=0;k<n;k++) {
			if(a[k][0]!=a[k][1]) {
				System.out.println("rated");
				rated=true;
return;}

for (int m=0; m<n-1;m++) {
if( (a[m][0]<a[m+1][0]) ||(a[m][1]< a[m+1][1])) {
		System.out.println("unrated");
			notrated=true;
			return;
			}}

				System.out.println("maybe");

	}
}}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class IsItRated {

	// variables

	public static int n;
	public static int min = Integer.MAX_VALUE;
	public static boolean rated = false, unrated = false;

	// functions

	public static OnRead setMinAndIsRated = new OnRead() {
		@Override
		public boolean use(int i) {
			rated = intNP[i][0] != intNP[i][1];
			unrated = intNP[i][0] > min && !rated;
			if (min > intNP[i][0])
				min = intNP[i][0];
			return rated || unrated;
		}
	};
	public static void main(String[] args) {
		try {
			// readValues
			n = in.nextInt();
			intNPvalues(n, 2, setMinAndIsRated);
			// useFunctions
			// printResult
			if (rated)
				System.out.println("rated");
			else if (unrated)
				System.out.println("unrated");
			else System.out.println("maybe");
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// utils

	public static interface OnRead {
		public boolean use(int i);
	}

	public static OnRead doNothing = new OnRead() {
		@Override
		public boolean use(int i) {
			return false;
		}
	};

	public static void intNPvalues(int n, int p) throws IOException {
		intNPvalues(n, p, doNothing);
	}

	public static void intNPvalues(int n, int p, OnRead r) throws IOException {
		intNP = new int[n][p];
		boolean stopUse = false;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p; j++)
				intNP[i][j] = in.nextInt();
			stopUse = stopUse || r.use(i);
		}
	}

	public static int[][] intNP;

	public static FastScanner in = new FastScanner(System.in);

	public static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner(InputStream i) {
			reader = new BufferedReader(new InputStreamReader(i));
			tokenizer = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!tokenizer.hasMoreTokens())
				tokenizer = new StringTokenizer(reader.readLine());
			return tokenizer.nextToken();
		}

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

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

		public void close() throws IOException {
			reader.close();
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class IsItRated {

	// variables

	public static int n;
	public static int min = Integer.MAX_VALUE;
	public static boolean rated = false, unrated = false;

	// functions

	public static OnRead setMinAndIsRated = new OnRead() {
		@Override
		public boolean use(int i) {
			rated = intNP[i][0] != intNP[i][1];
			// unrated = intNP[i][0] > min && !rated;
			if (min < intNP[i][0])
				min = intNP[i][0];
			else
				unrated = !rated;
			return rated || unrated;
		}
	};
	public static void main(String[] args) {
		try {
			// readValues
			n = in.nextInt();
			intNPvalues(n, 2, setMinAndIsRated);
			// useFunctions
			// printResult
			if (rated)
				System.out.println("rated");
			else if (unrated)
				System.out.println("unrated");
			else System.out.println("maybe");
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// utils

	public static interface OnRead {
		public boolean use(int i);
	}

	public static OnRead doNothing = new OnRead() {
		@Override
		public boolean use(int i) {
			return false;
		}
	};

	public static void intNPvalues(int n, int p) throws IOException {
		intNPvalues(n, p, doNothing);
	}

	public static void intNPvalues(int n, int p, OnRead r) throws IOException {
		intNP = new int[n][p];
		boolean stopUse = false;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p; j++)
				intNP[i][j] = in.nextInt();
			stopUse = stopUse || r.use(i);
		}
	}

	public static int[][] intNP;

	public static FastScanner in = new FastScanner(System.in);

	public static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner(InputStream i) {
			reader = new BufferedReader(new InputStreamReader(i));
			tokenizer = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!tokenizer.hasMoreTokens())
				tokenizer = new StringTokenizer(reader.readLine());
			return tokenizer.nextToken();
		}

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

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

		public void close() throws IOException {
			reader.close();
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class IsItRated {

	// variables

	public static int n;
	public static int min = Integer.MAX_VALUE;
	public static boolean rated = false, unrated = false;

	// functions

	public static OnRead setMinAndIsRated = new OnRead() {
		@Override
		public boolean use(int i) {
			rated = rated || intNP[i][0] != intNP[i][1];
			unrated = unrated || intNP[i][0] > min;
			if (min > intNP[i][0])
				min = intNP[i][0];
			return false;
		}
	};
	public static void main(String[] args) {
		try {
			// readValues
			n = in.nextInt();
			intNPvalues(n, 2, setMinAndIsRated);
			// useFunctions
			// printResult
			if (rated)
				System.out.println("rated");
			else if (unrated)
				System.out.println("unrated");
			else System.out.println("maybe");
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// utils

	public static interface OnRead {
		public boolean use(int i);
	}

	public static OnRead doNothing = new OnRead() {
		@Override
		public boolean use(int i) {
			return false;
		}
	};

	public static void intNPvalues(int n, int p) throws IOException {
		intNPvalues(n, p, doNothing);
	}

	public static void intNPvalues(int n, int p, OnRead r) throws IOException {
		intNP = new int[n][p];
		boolean stopUse = false;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p; j++)
				intNP[i][j] = in.nextInt();
			stopUse = stopUse || r.use(i);
		}
	}

	public static int[][] intNP;

	public static FastScanner in = new FastScanner(System.in);

	public static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner(InputStream i) {
			reader = new BufferedReader(new InputStreamReader(i));
			tokenizer = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!tokenizer.hasMoreTokens())
				tokenizer = new StringTokenizer(reader.readLine());
			return tokenizer.nextToken();
		}

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

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

		public void close() throws IOException {
			reader.close();
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class IsItRated {

	// variables

	public static int n;
	public static int min = Integer.MAX_VALUE;
	public static boolean rated = false, unrated = false;

	// functions

	public static OnRead setMinAndIsRated = new OnRead() {
		@Override
		public boolean use(int i) {
			rated = intNP[i][0] != intNP[i][1];
			unrated = intNP[i][0] > min;
			if (min > intNP[i][0])
				min = intNP[i][0];
			return rated || unrated;
		}
	};
	public static void main(String[] args) {
		try {
			// readValues
			n = in.nextInt();
			intNPvalues(n, 2, setMinAndIsRated);
			// useFunctions
			// printResult
			if (rated)
				System.out.println("rated");
			else if (unrated)
				System.out.println("unrated");
			else System.out.println("maybe");
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// utils

	public static interface OnRead {
		public boolean use(int i);
	}

	public static OnRead doNothing = new OnRead() {
		@Override
		public boolean use(int i) {
			return false;
		}
	};

	public static void intNPvalues(int n, int p) throws IOException {
		intNPvalues(n, p, doNothing);
	}

	public static void intNPvalues(int n, int p, OnRead r) throws IOException {
		intNP = new int[n][p];
		boolean stopUse = false;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p; j++)
				intNP[i][j] = in.nextInt();
			stopUse = stopUse || r.use(i);
		}
	}

	public static int[][] intNP;

	public static FastScanner in = new FastScanner(System.in);

	public static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner(InputStream i) {
			reader = new BufferedReader(new InputStreamReader(i));
			tokenizer = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!tokenizer.hasMoreTokens())
				tokenizer = new StringTokenizer(reader.readLine());
			return tokenizer.nextToken();
		}

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

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

		public void close() throws IOException {
			reader.close();
		}

	}

}


import java.util.Scanner;

public class Isitrated {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		String ans = "maybe";
		int last = 5000;
		for (int i = 0; i < n; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			if (a != b)
				ans = "rated";
			if (b > last && !ans.equals("rated"))
				ans = "unrated";
			last = a;
		}
		System.out.println(ans);
		input.close();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Isitrated {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		Map<String, Integer> map = new HashMap<String, Integer>();
		int n = Integer.valueOf(input.readLine());
		String massage = "unrated";
		for (int i = 0; i < n; i++) {
			String[] s = input.readLine().split(" ");
			if (!s[0].contains(s[1])) {
				massage = "rated";
				break;
			} else {
				if (!map.containsKey(s[0])) {
					map.put(s[0], 1);
				} else {
					massage = "maybe";
					break;
				}
			}
		}
		System.out.println(massage);
	}
}


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

public class Isitrated {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> arr = new ArrayList<String>();
		int n = Integer.valueOf(input.readLine());
		String massage = "unrated";
		for (int i = 0; i < n; i++) {
			String[] s = input.readLine().split(" ");
			if (!s[0].contains(s[1])) {
				massage = "rated";
				break;
			} else {
				if (i != 0) {
					if (!s[0].equals(arr.get(i - 1))) {
						arr.add(s[0]);
					} else {
						massage = "maybe";
						break;
					}
				} else {
					arr.add(s[0]);
				}
			}
		}
		System.out.println(massage);
	}
}


import java.util.Scanner;

public class IsItRated {
	static int [][] arr ;
	public static void main(String[]args){
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();

		arr = new int [n][2];

		for(int i = 0,oldPoints,newPoints ; i < n ; i++){
			oldPoints= sc.nextInt();
			newPoints=sc.nextInt();
			arr[i][0]=oldPoints;
			arr[i][1]=newPoints;
		}
		if(isChanged())System.out.println("rated");
		else if(isSorted())System.out.println("maybe");
		else System.out.println("unrated");
	}
	static boolean isChanged(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i][1]!=0)return true;
			return false;
	}
	static boolean isSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(!(arr[i][0]-arr[i+1][0]>0))return false;
		return true;
	}
}


import java.util.Scanner;

public class IsItRated {
	static int [][] arr ;
	public static void main(String[]args){
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();

		arr = new int [n][2];

		for(int i = 0,oldPoints,newPoints ; i < n ; i++){
			oldPoints= sc.nextInt();
			newPoints=sc.nextInt();
			arr[i][0]=oldPoints;
			arr[i][1]=newPoints;
		}
		if(isChanged())System.out.println("rated");
		else if(isINCSorted()||isDECSorted())System.out.println("maybe");
		else System.out.println("unrated");
	}
	static boolean isChanged(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i][1]!=0)return true;
			return false;
	}
	static boolean isDECSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]<0){
				return false;
			}
		return true;
	}
	static boolean isINCSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]>0){
				return false;
			}
		return true;
	}
}


import java.util.Scanner;

public class IsItRated {
	static int [][] arr ;
	public static void main(String[]args){
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();

		arr = new int [n][2];

		for(int i = 0,oldPoints,newPoints ; i < n ; i++){
			oldPoints= sc.nextInt();
			newPoints=sc.nextInt();
			arr[i][0]=oldPoints;
			arr[i][1]=newPoints;
		}
		if(isChanged())System.out.println("rated");
		else if(isSorted())System.out.println("maybe");
		else System.out.println("unrated");
	}
	static boolean isChanged(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i][1]!=0)return true;
			return false;
	}
	static boolean isSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]<0){
				return false;
			}
		return true;
	}
}


import java.util.Scanner;

public class IsItRated {
	static int [][] arr ;
	public static void main(String[]args){
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();

		arr = new int [n][2];

		for(int i = 0,oldPoints,newPoints ; i < n ; i++){
			oldPoints= sc.nextInt();
			newPoints=sc.nextInt();
			arr[i][0]=oldPoints;
			arr[i][1]=newPoints;
		}
		boolean sorted =isINCSorted()||isDECSorted();
		if(isChanged())System.out.println("rated");
		else if(sorted)System.out.println("maybe");
		else System.out.println("unrated");
	}
	static boolean isChanged(){
		for(int i = 0 ;i  < arr.length;i++)
			if(arr[i][0]-arr[i][1]!=0){
				return true;
			}
		return false;
	}
	static boolean isDECSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]<0){
				return false;
			}
		return true;
	}
	static boolean isINCSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]>0){
				return false;
			}
		return true;
	}
}


import java.util.Scanner;

public class IsItRated {
	static int [][] arr ;
	public static void main(String[]args){
		Scanner sc= new Scanner(System.in);
		int n = sc.nextInt();

		arr = new int [n][2];

		for(int i = 0,oldPoints,newPoints ; i < n ; i++){
			oldPoints= sc.nextInt();
			newPoints=sc.nextInt();
			arr[i][0]=oldPoints;
			arr[i][1]=newPoints;
		}
		boolean sorted =isDECSorted();
		if(isChanged())System.out.println("rated");
		else if(sorted)System.out.println("maybe");
		else System.out.println("unrated");
	}
	static boolean isChanged(){
		for(int i = 0 ;i  < arr.length;i++)
			if(arr[i][0]-arr[i][1]!=0){
				return true;
			}
		return false;
	}
	static boolean isDECSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]<0){
				return false;
			}
		return true;
	}
	static boolean isINCSorted(){
		for(int i = 0 ;i  < arr.length-1;i++)
			if(arr[i][0]-arr[i+1][0]>0){
				return false;
			}
		return true;
	}
}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        Set<String> set = new HashSet<>();
        for (xd object : nuevaList) {
            set.add(object.dos);
        }
        if(set.size() == nuevaList.size()){
        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                }
            }
        }}
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        Set<String> set = new HashSet<>();
        for (xd object : nuevaList) {
            set.add(object.dos);
        }
        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                    break;
                }
            }
        }
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        Set<String> set = new HashSet<>();
        for (xd object : nuevaList) {
            set.add(object.dos);
        }
        if(set.size() == nuevaList.size()){
        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                }
            }
        }}
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            if(numero==1000)
                System.out.println(set.size() + "  " + nuevaList.size());
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);
        if(state==2){
        for (int i = 0; i < lista.size(); i++) {
            if(!nuevaList.get(i).dos.equals(lista.get(i).dos)){
                state = 1;
                System.out.println(lista.get(i).dos +"  "+ nuevaList.get(i).dos);
            }
        }}
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }
}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                }
            }
        }
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                }
            }
        }
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            if(numero==1000)
                System.out.println(set.size() + "  " + nuevaList.size());
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);
        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                if(!(nuevaList.get(i).dos.equals(lista.get(i).dos)) && !(nuevaList.get(i).uno.equals(lista.get(i).uno))){
                    state = 1;
                }
            }
        }
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }
}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);

        Set<String> set = new HashSet<>();
        for (xd object : nuevaList) {
            set.add(object.dos);
        }
        if(state==2){
            for (int i = 0; i < lista.size(); i++) {
                for (int j = i+1; j < lista.size(); j++) {
                    if(Integer.parseInt(lista.get(i).uno) < Integer.parseInt(lista.get(j).uno)){
                        state = 1;
                    }
                }
            }
        }
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

    @Override
    public String toString() {
        return "xd{" + "uno=" + uno + ", dos=" + dos + '}';
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }

}


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

/**
 *
 * @author brown
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Missbo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int numero = Integer.parseInt(br.readLine());
        List<xd> lista = new ArrayList<>();
        for (int i = 0; i < numero; i++) {
            lista.add(new xd(br.readLine()));
        }
        int state = 2;
        List<xd> nuevaList = new ArrayList<>();
        for (xd object : lista) {
            nuevaList.add(object);
            if(!object.uno.equals(object.dos)){
                state = 0;
            }
        }
        Collections.sort(nuevaList, new Sortbydos());
        Collections.reverse(nuevaList);
        if(state==2){
        for (int i = 0; i < lista.size(); i++) {
            if(!nuevaList.get(i).dos.equals(lista.get(i).dos)){
                state = 1;
            }
        }}
        if(state==0){
            System.out.println("rated");
        }
        else if(state==1){
            System.out.println("unrated");
        }
        else{
            System.out.println("maybe");
        }

    }
}
class xd{

    String uno;
    String dos;

    public xd(String entrada) {
        String[] ju = entrada.split(" ");
        this.uno = (ju[0]);
        this.dos = (ju[1]);
    }

}

class Sortbydos implements Comparator<xd>
{
    // Used for sorting in ascending order of
    // roll name
    public int compare(xd a, xd b)
    {
        return a.dos.compareTo(b.dos);
    }
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
    int t;
    cin>>t;
    while(t--){
        unordered_map<int,int> mp;
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            mp[arr[i]]++;
        }
        int num;
        int maxi=INT_MAX;
        for(auto i:mp){
            if(i->second==1 && i->first<maxi){
                num=mp.first;

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]==num){
                cout<<i+1<<endl;
                return 0;
            }
        }
    }
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
    int t;
    cin>>t;
    while(t--){
        unordered_map<int,int> mp;
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            mp[arr[i]]++;
        }
        int num;
        int maxi=INT_MAX;
        for(auto i:mp){
            if(i.second==1 && i.first<maxi){
                num=mp.first;

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]==num){
                cout<<i+1<<endl;
                return 0;
            }
        }
    }
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
    int t;
    cin>>t;
    while(t--){
        map<int,int> mp;
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            mp[arr[i]]++;
        }
        int num=INT_MIN;
        int maxi=INT_MAX;
        for(auto i:mp){
            if(i.second==1 && i.first<maxi){
                num=i.first;

            }
        }
        if(num==INT_MIN)cout<<-1<<endl;
        else{
            for(int i=0;i<n;i++){
            if(arr[i]==num){
                cout<<i+1<<endl;
                break;
            }
        }
        }

    }
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
    int t;
    cin>>t;
    while(t--){
        unordered_map<int,int> mp;
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            mp[arr[i]]++;
        }
        int num;
        int maxi=INT_MAX;
        for(auto i:mp){
            if(i.second==1 && i.first<maxi){
                num=i.first;

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]==num){
                cout<<i+1<<endl;
                return 0;
            }
        }
    }
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
    int t;
    cin>>t;
    while(t--){
        unordered_map<int,int> mp;
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
            mp[arr[i]]++;
        }
        int num=INT_MIN;
        int maxi=INT_MAX;
        for(auto i:mp){
            if(i.second==1 && i.first<maxi){
                num=i.first;

            }
        }
        if(num==INT_MIN)cout<<-1<<endl;
        else{
            for(int i=0;i<n;i++){
            if(arr[i]==num){
                cout<<i+1<<endl;
                break;
            }
        }
        }

    }
}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

void solve(){
   int n ;
   cin >> n ;
   multiset<int> m ;
   for(int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    m.insert(x) ;
   }
   for(int i : m){
    if(m.count(i)==1)
    {
        cout << i << endl;
        return ;
    }
   }
   cout << - 1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

const int MAXN = 1e5 + 4 ;
int a[MAXN] , f[MAXN] , ans[MAXN];
void solve(){
   int n ;
   cin >> n ;

   for(int i = 0 ; i<  n ; i++ ){
    cin >> a[i] ;
    ans[a[i]] = i + 1 ;
    f[a[i]]++ ;
   }
   sort( a , a + n ) ;
   for(int i = 0 ; i < n ; i++ ){
    if( f[a[i]] == 1){
        cout << ans[i] << endl ;
        return ;
    }
   }
   cout << -1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
        for(int i = 0 ; i< n ; i++ )
            f[a[i]] = 0  ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

const int MAXN = 2e5 + 4 ;
int a[MAXN] , f[MAXN] , ans[MAXN] , n ;
void solve(){

   cin >> n ;

   for(int i = 0 ; i<  n ; i++ ){
    cin >> a[i] ;
    ans[a[i]] = i + 1 ;
    f[a[i]]++ ;
   }
   sort( a , a + n ) ;
   for(int i = 0 ; i < n ; i++ ){
    if( f[a[i]] == 1){
        cout << ans[a[i]] << endl ;
        return ;
    }
   }
   cout << -1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
        for(int i = 0 ; i< n ; i++ )
            f[a[i]] = 0  ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

const int MaxN = 1e5 + 4 ;
int a[MAXN] , f[MAXN] , ans[MAXN];
void solve(){
   int n ;
   cin >> n ;

   for(int i = 0 ; i<  n ; i++ ){
    cin >> a[i] ;
    ans[a[i]] = i + 1 ;
    f[a[i]]++ ;
   }
   sort( a , a + n ) ;
   for(int i = 0 ; i < n ; i++ ){
    if( f[a[i]] == 1){
        cout << ans[i] << endl ;
        return ;
    }
   }
   cout << -1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
        for(int i = 0 ; i< n ; i++ )
            f[a[i]] = 0  ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

void solve(){
   int n ;
   cin >> n ;
   multiset<int> m ;
   map<int> mp ;
   for(int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    mp[x] = i + 1 ;
    m.insert(x) ;
   }
   for(int i : m){
    if(m.count(i)==1)
    {
        cout << mp[i] << endl;
        return ;
    }
   }
   cout << - 1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

const int MAXN = 1e5 + 4 ;
int a[MAXN] , f[MAXN] , ans[MAXN] , n ;
void solve(){

   cin >> n ;

   for(int i = 0 ; i<  n ; i++ ){
    cin >> a[i] ;
    ans[a[i]] = i + 1 ;
    f[a[i]]++ ;
   }
   sort( a , a + n ) ;
   for(int i = 0 ; i < n ; i++ ){
    if( f[a[i]] == 1){
        cout << ans[i] << endl ;
        return ;
    }
   }
   cout << -1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
        for(int i = 0 ; i< n ; i++ )
            f[a[i]] = 0  ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

void solve(){
   int n ;
   cin >> n ;
   multiset<int> m ;
   map<int,int> mp ;
   for(int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    mp[x] = i + 1 ;
    m.insert(x) ;
   }
   for(int i : m){
    if(m.count(i)==1)
    {
        cout << mp[i] << endl;
        return ;
    }
   }
   cout << - 1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

const int MAXN = 1e5 + 4 ;
int a[MAXN] , f[MAXN] , ans[MAXN] , n ;
void solve(){

   cin >> n ;

   for(int i = 0 ; i<  n ; i++ ){
    cin >> a[i] ;
    ans[a[i]] = i + 1 ;
    f[a[i]]++ ;
   }
   sort( a , a + n ) ;
   for(int i = 0 ; i < n ; i++ ){
    if( f[a[i]] == 1){
        cout << ans[a[i]] << endl ;
        return ;
    }
   }
   cout << -1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
        for(int i = 0 ; i< n ; i++ )
            f[a[i]] = 0  ;
    }

}


#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll ;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef priority_queue< pi, vector <pi> , greater<pi> > spq;

void solve(){
   int n ;
   cin >> n ;
   multiset<int> m ;
   for(int i = 0 ; i < n ; i++ )
    cin >> a[i];
   for(int i : m){
    if(m.count(i)==1)
    {
        cout << i << endl;
        return ;
    }
   }
   cout << - 1 << endl;
}
int main(){
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
    }

}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
  ll i, j, n, m;
  int* mini;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  for(i=0;i<n;i++){
      m=count(a.begin(),a.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      cout<<-1<<endl;
  }
  else{
  m=*min_element(b.begin(),b.end());
  cout<<m<<endl;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    cin >> t;
     while(t--) {
       solve();
     }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, j, n, m;
  int* mini;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  vector<int>c(a);
  auto it=unique(a.begin(),a.end());
  a.resize(distance(a.begin(),it));
  for(i=0;i<a.size();i++){
      m=count(c.begin(),c.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      return -1;
  }
  else{
  m=*min_element(b.begin(),b.end());
  auto it = find(c.begin(),c.end(),m);
  m=it-c.begin()+1;
  return m;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    vector<int> ans;
    int t = 1,n;
    cin >> t;
     while(t--) {
       n=solve();
       ans.push_back(n);
     }
     for(auto it: ans){
         cout<<it<<endl;
     }

    return 0;
}


#include<bits/stdc++.h>
#include <cstdlib>

using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];
void printcombination(char arr[],string prefix,int n, int k,int m);
int parentof(vector<int> x,vector<int> y, int i);
int parentof(vector<int> x,vector<int> y, int i){
    if(x[i]==-1){
        return 1;
    }
    auto it=find(y.begin(),y.end(),x[i]);
    if(it==y.end()){
         parentof(x,y,(x[i]-1));
    }
    else
        return 0;

}
void solve() {
  int i, j,k, m,x,y,count=0;
  vector<int> n[2000],l;
  cin>>k;
  for(i=0;i<k;i++){
     cin>>m;
     l.push_back(m);
  }
  j=0;
  for(i=0;i<k;i++){
      j=0;
      lable:
      if(n[j].size()==0){
          count++;
          n[j].push_back((i+1));
      }
      else if(parentof(l,n[j],i)){
          n[j].push_back((i+1));
      }
      else
      {
          j++;
          goto lable;
      }

  }

  cout<<count;

}
/*void printcombination(char arr[],string prefix,int n, int k,int m){
    int i,j;
    if(k<3){
        j=stoi(prefix);
        if(m%j==0){
            cout<<"YES";
            exit(0);
        }
        if(k==0){
            return;
        }
    }
    for(i=0;i<n;i++){
        string newprefix;
        newprefix=prefix+arr[i];
        printcombination(arr,newprefix,n,k-1,m);
    }
}
*/

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    //cin >> t;
     //while(t--) {
       solve();
     //}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, n, m;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  vector<int> c(a);
  auto it=unique(a.begin(),a.end());
  a.resize(distance(a.begin(),it));
  for(i=0;i<a.size();i++){
      m=count(c.begin(),c.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      cout<<-1<<endl;
  }
  else{
  m=*min_element(b.begin(),b.end());
  it = find(c.begin(),c.end(),m);
  m=it-c.begin()+1;
  cout<<m<<endl;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
     while(t--) {
       solve();
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, n, m;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  vector<int> c(a);
  auto it=unique(a.begin(),a.end());
  a.resize(distance(a.begin(),it));
  for(i=0;i<a.size();i++){
      m=count(c.begin(),c.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      cout<<-1<<endl;
  }
  else{
  m=*min_element(b.begin(),b.end());
  auto it = find(c.begin(),c.end(),m);
  m=it-c.begin()+1;
  cout<<m<<endl;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
     while(t--) {
       solve();
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, n, m;
  cin>>n;
  vi v(n);
  map<int,int> ma;

  for(auto &it:v){
      cin>>it;
  }
  for(auto it:v){
      ma[it]++;
  }
  ll inx=INT_MAX,val=INT_MAX;
  bool c=false;
  for(i=0;i<n;i++){
      if(ma[v[i]]==1){
          if(v[i]<val){
              inx=i+1;
              val=v[i];
              c=true;
          }
      }
  }
  (c)?cout<<inx<<nx:cout<<-1<<nx;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
     while(t--) {
       solve();
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, j, n, m;
  int* mini;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  for(i=0;i<n;i++){
      m=count(a.begin(),a.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      return -1;
  }
  else{
  m=*min_element(b.begin(),b.end());
  auto it = find(a.begin(),a.end(),m);
  m=it-a.begin()+1;
  return m;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    vector<int> ans;
    int t = 1,n;
    cin >> t;
     while(t--) {
       n=solve();
       ans.push_back(n);
     }
     for(auto it: ans){
         cout<<it<<endl;
     }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, n, m;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  vector<int>c(a);
  auto it=unique(a.begin(),a.end());
  a.resize(distance(a.begin(),it));
  for(i=0;i<a.size();i++){
      m=count(c.begin(),c.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      cout<<-1<<endl;
  }
  else{
  m=*min_element(b.begin(),b.end());
  auto it = find(c.begin(),c.end(),m);
  m=it-c.begin()+1;
  cout<<m<<endl;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
     while(t--) {
       solve();
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define nx '\n'
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define foi(i) for(auto i=v.begin();i!=v.end();i++)
#define ll long long int
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
vector<string> split (string s, string delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();

    string token;
    vector<string> res;

    while ((pos_end = s.find (delimiter, pos_start)) != string::npos) {

        token = s.substr (pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;

        res.push_back (token);
    }

    res.push_back (s.substr (pos_start));
return res;
}

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int solve() {
  ll i, n, m;
  vector<int> a,b;
  cin>>n;
  for(i=0;i<n;i++){
      cin>>m;
      a.push_back(m);
  }
  vector<int>c(a);
  auto it=unique(a.begin(),a.end());
  a.resize(distance(a.begin(),it));
  for(i=0;i<a.size();i++){
      m=count(c.begin(),c.end(),a[i]);
      if(m==1){
          b.push_back(a[i]);
      }
  }
  if(b.size()==0){
      return -1;
  }
  else{
  m=*min_element(b.begin(),b.end());
  auto it = find(c.begin(),c.end(),m);
  m=it-c.begin()+1;
  return m;
  }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    vector<int> ans;
    int t = 1,n;
    cin >> t;
     while(t--) {
       n=solve();
       ans.push_back(n);
     }
     for(auto it: ans){
         cout<<it<<endl;
     }

    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int t, a[1000000], b[10000], c[10000], n, i, j, p, k, l;
	cin >> t;
	while (t--)
	{
		cin >> n;
		for (i = 0; i < n; i++)
			cin >> a[i];
		sort(a, a + n);
		if (a[0] != a[1])
			cout << a[0] << endl;
		else
			cout << -1 << endl;
	}
}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[100007]={};
	int arr2[100007]={};

	ll n, min=99999999, mx=-1;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[i]==1){
			min=i;
			break;
		}
}

  if(min!=99999999){
	For(i, 1, n){
		if(arr[i]==min){
			cout<<i<<"\n";
			break;
		}
}
}

else cout<<"-1\n";

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


 #include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[200007]={};
	int arr2[200007]={};

	ll n, min=9999999, pos=-1;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[arr[i]]==1){
			if(arr[i]<min){
			min=arr[i];
			pos=i;
		}
		}
}

  cout<<pos<<"\n";

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[200007]={};
	int arr2[200007]={};

	ll n, min=9999999;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[arr[i]]==1){
			cout<<i<<"\n";
						min=-1;
			break;
		}
}

  if(min==9999999)cout<<"-1\n";

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[100007];
	int arr2[100007];

	ll n, min=9999999, mx=-1;
	bool cont=true;
	cin>>n;
	F0r(i, n){
	arr[i]=0;
	arr2[i]=0;
	}

	F0r(i, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

if(n==1){cout<<arr[0]<<"\n"; cont=false;}
mx=*max_element(arr, arr+n);
//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, mx){
		if(arr2[i]==1){
			min=i;
			break;
		}
}

if(cont){
  if(min!=9999999){
	F0r(i, n){
		if(arr[i]==min){
			cout<<i+1<<"\n";
			break;
		}
}
}

else cout<<"-1\n";
}
}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[1000007]={};
	int arr2[1000007]={};

	ll n, min=99999999, mx=-1;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[i]==1){
			min=i;
			break;
		}
}

  if(min!=99999999){
	For(i, 1, n){
		if(arr[i]==min){
			cout<<i<<"\n";
			break;
		}
}
}

else cout<<"-1\n";

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


 #include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[200007]={};
	int arr2[200007]={};

	ll n, min=9999999, pos=0;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[arr[i]]==1 and arr[i]<min){
			pos=i;
		}
}

  if(min==9999999)cout<<"-1\n";
 else cout<<pos<<endl;

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[100007];
	int arr2[100007];

	ll n, min=99999999, mx=-1;
	cin>>n;
	F0r(i, n){
	arr[i]=0;
	arr2[i]=0;
	}

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[i]==1){
			min=i;
			break;
		}
}

  if(min!=99999999){
	For(i, 1, n){
		if(arr[i]==min){
			cout<<i<<"\n";
			break;
		}
}
}

else cout<<"-1\n";

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[1000007]={};
	int arr2[1000007]={};

	ll n, min=99999999;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[i]==1){
			min=i;
			break;
		}
}

  if(min==99999999)cout<<"-1\n";

	else {
		For(i, 1, n){
		if(arr[i]==min){
			cout<<i<<"\n";
			break;
		}
}
}

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


 #include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[200007]={};
	int arr2[200007]={};

	ll n, min=9999999, pos=0;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[arr[i]]==1 and arr[i]<min){
			min=i;

		}
}

  if(min==9999999)cout<<"-1\n";
 else cout<<min<<endl;

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


 #include<bits/stdc++.h>
using namespace std;

//Types
using ll = long long;
using db = double;
using ldb = long double;
using str = string;

//Pairs
#define mkp make_pair
#define f first
#define s second

//Vectors
#define pb push_back
#define sz(vec) ((int)vec.size())
#define all(vec) (vec.begin(), vec.end())

//Loops
#define For(i, a, b) for(int i=(a); i<=(b); ++i)
#define F0r(i,n) for(int i=(0) ; i<(n) ; ++(i))
#define ROF(i, a, b) for(int i = (b-1); i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)

//Strings
//(put stuff here)

//Constants / other stuff
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

	int arr[200007]={};
	int arr2[200007]={};

	ll n, min=9999999, pos=-1;
	cin>>n;

	For(i,1, n){
		cin>>arr[i];
	arr2[arr[i]]++;
}

//For(i, 1, mx+1)cout<<vec[i]<<" ";
//cout<<endl<<mx;

For(i,1, n){
		if(arr2[arr[i]]==1){
			if(arr[i]<min){
			min=arr[i];
			pos=i;
		}
		}
}

  cout<<pos;

}

 int main(){
    Speeed

 ll t;
 cin>>t;

 while(t--){

    solve();
 }

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }
       map<int, int>::iterator x=m.begin();
       int c;
        while(x!=m.end())
       {
           if(x->second==1)
          { c=x->first;
           break;}
           x++;
       }
       int s;
       for(int i=0;i<n;i++){
         if(v[i]==c)
         {s==i;
             break;
         }

        }
        cout<<s<<endl;
        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }

       map<int, int>::iterator x=m.begin();
        while(x!=m.end()&& x->second==1)
       {

           x++;
       }
       if(x==m.end())
       cout<<"-1"<<endl;
       else{
       int s;
       for(int i=0;i<n;i++){
         if(v[i]==x->first)
         {s==i;
             break;
         }

       }
          cout<<s<<endl;
        }

        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }

       map<int, int>::iterator x=m.begin();
        while(x!=m.end()&& x->second==1)
       {

           x++;
       }
       if(x==m.end())
       cout<<"-1"<<endl;
       else{
       int s;
       for(int i=0;i<n;i++){
         if(v[i]==x.first)
         {s==i;
             break;
         }

       }
          cout<<s<<endl;
        }

        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }
        int c=-1,s;
       map<int, int>::iterator x=m.begin();
        while(x!=m.end())
       {
           if(x->second==1)
           {
               c=x->first;
               break;
           }
           x++;
       }
       if(c==-1)
       {cout<<c<<endl;}

       else{
       for(int i=0;i<n;i++){
         if(v[i]==c)
         {s=i+1; }

       }
          cout<<s<<endl;
        }

        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }
        int c=-1,s;
       map<int, int>::iterator x=m.begin();
        while(x!=m.end())
       {
           if(x->second==1)
           {
               c=x->first;
           }
           x++;
       }
       if(c==-1)
       cout<<c<<endl;
       else{

       for(int i=0;i<n;i++){
         if(v[i]==c)
         {s==i+1;
             break;
         }

       }
          cout<<s<<endl;
        }

        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]:++;
        }
       map<int, int>::iterator x=m.begin();
        while(x!=m.end())
       {
           if(x->second==1)
          { c=x->first;
           break;}
           x++;
       }
       int s;
       for(int i=0;i<n;i++){
         if(v[i]==c)
         {s==i;
             break;
         }

        }
        cout<<s<<endl;
        t--;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t>0){
        int n;
        cin>>n;
        vector<int>v(n);
        map<int,int>m;
        for(int i=0;i<n;i++){
         cin>>v[i];
         m[v[i]]++;
        }
        int c=-1,s;
       map<int, int>::iterator x=m.begin();
        while(x!=m.end())
       {
           if(x->second==1)
           {
               c=x->first;
           }
           x++;
       }
       if(c==-1)
       {cout<<c<<endl;}

       else{
       for(int i=0;i<n;i++){
         if(v[i]==c)
         {s==i+1; }

       }
          cout<<s<<endl;
        }

        t--;

    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, x=1000000; cin>>n; int a[n];
        map <int, int> m;
        map <int, int> :: iterator it;
        for(i=0; i<n; i++)
        {
            cin>>a[i];
            m[a[i]]++;
        }
        for(it=m.begin(); it!=m.end(); it++)
        {
            if(it->second==1)x=min(x, it->first);
        }
        if(x==1000000) cout<<-1<<endl;
        else
        {
            for(i=0; i<n; i++)
            {
                if(x==a[i]) {cout<<i+1<<endl; break;}
            }
        }
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, y=1; cin>>n; int a[n], x=1000000;
        for(i=0; i<n; i++) cin>>a[i];
        for(i=0; i<n; i++)
        {
            if(x!=a[i]) x=min(a[i], x);
            else x=1000000;
        }
        if(x==1000000) cout<<-1<<endl;
        else
        {
            for(i=0; i<n; i++) {if(x==a[i]) {cout<<i+1<<endl; break;}}
        }
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, x=1000000, y=0; cin>>n; int a[n], b[1000000]={0};
        for(i=0; i<n; i++) {cin>>a[i]; b[a[i]]++;}
        sort(b, b+1000000);
        for(i=1; i<1000000; i++)
        {
            if(b[i]==1) x=min(x, i);
        }
        for(i=0; i<n; i++) {if(x==a[i]) {cout<<i+1<<endl; y=1; break;}}
        if(y==0) cout<<-1<<endl;
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, y=1; cin>>n; int a[n], x=1000000;
        for(i=0; i<n; i++) cin>>a[i];
        vector <int> v;
        for(i=0; i<n; i++)
        {
            if(find(v.begin(), v.end(), a[i])==v.end()) x=min(a[i], x);
            else x=1000000;
            v.push_back(a[i]);
        }
        if(x==1000000) cout<<-1<<endl;
        else
        {
            for(i=0; i<n; i++) {if(x==a[i]) {cout<<i+1<<endl; break;}}
        }
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, x=1000000, y=0; cin>>n; int a[n], b[1000000]={0};
        for(i=0; i<n; i++) {cin>>a[i]; b[a[i]]++;}
        sort(b, b+100000)
        for(i=1; i<1000000; i++)
        {
            if(b[i]==1) x=min(x, i)
        }
        for(i=0; i<n; i++) {if(v[0]==a[i]) {cout<<i+1<<endl; y=1; break;}}
        if(y==0) cout<<-1<<endl;
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, y=1; cin>>n; int a[n], b[n], x=1000000;
        for(i=0; i<n; i++) {cin>>a[i]; b[i]=a[i];}
        sort(a, a+n);
        for(i=0; i<n; i++)
        {
            if(x!=a[i]) x=min(a[i], x);
            else x=a[i];
        }
        if(x==1000000) cout<<-1<<endl;
        else
        {
            for(i=0; i<n; i++) {if(x==b[i]) {cout<<i+1<<endl; break;}}
        }
    }

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
        int n, i, j; cin>>n; int a[n];
        for(i=0; i<n; i++) cin>>a[i];
        vector <int> v, v1;
        vector <int> :: iterator it;
        for(i=0; i<n; i++)
        {
            it=find(v.begin(), v.end(), a[i]);
            if(it!=v.end()) {v1.push_back(*it); v.erase(it);}
            else if(find(v1.begin(), v1.end(), a[i])==v1.end()) v.push_back(a[i]);
        }
        sort(v.begin(), v.end());
        if(v.size()==0) cout<<-1<<endl;
        else
        {
            for(i=0; i<n; i++) {if(v[0]==a[i]) {cout<<i+1<<endl; break;}}
        }
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e6+10;

struct Node{
    int numm,time,index;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;
        cin>>n;

        memset(Data,0,sizeof(Data));
        int cnt=0;
        for(int i=1;i<=n;i++){
            cin>>num;
            bool flag=true;
            for(int j=0;j<cnt;j++){
                if(Data[j].numm==num){Data[j].time++;flag=false;break;}
            }
            if(flag) {
                Data[cnt].numm=num;
                Data[cnt].index=i;
                Data[cnt++].time=1;

                //cout<<Data[cnt-1].numm<<" "<<Data[cnt-1].index<<" "<<Data[cnt-1].time<<endl;
            }

        }

        int minn=200010,mindex=0;
        for(int i=0;i<cnt;i++){
            if(Data[i].time==1&&Data[i].numm<minn){
                minn=Data[i].numm;
                mindex=Data[i].index;
            }
        }

        if(minn==200010) cout<<-1<<endl;
        else cout<<mindex<<endl;

    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e5+50;

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;

        cin>>n;
        int Data[maxn],index[maxn];

        for(int i=0;i<=n+1;i++){
            Data[i]=index[i]=0;
        }
        for(int i=0;i<n;i++){
            cin>>num;
            Data[num]++;
            //cout<<num<<":"<<Data[num]<<endl;
            index[num]=i+1;
        }

        int mindex=-1;
        for(int i=0;i<=n;i++){
            if(Data[i]==1) {
                mindex=index[i];
                break;
            }
        }
        cout<<mindex<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e5+50;

struct Node{
    int index,time;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;
        cin>>n;
        int minn=200010;

        memset(Data,0,sizeof(Data));
        for(int i=1;i<=n;i++){
            cin>>num;
            Data[num].time++;
            Data[num].index=i;
        }

        int mindex=-1;
        for(int i=1;i<=n;i++){
            if(Data[i].time==1) {
                mindex=Data[i].index;
                break;
            }
        }
        cout<<mindex<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e6+10;

struct Node{
    int index,time;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;
        cin>>n;
        int minn=200010;

        memset(Data,0,sizeof(Data));
        for(int i=1;i<=n;i++){
            cin>>num;
            Data[num].time++;
            Data[num].index=i;

        }
        int mindex=0;
        for(int i=1;i<=200010;i++){
            if(Data[i].time==1&&i<minn) minn=i,mindex=Data[i].index;
        }

        if(minn==200010) cout<<-1<<endl;
        else cout<<mindex<<endl;

    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e5+50;

struct Node{
    int index,time;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;

        cin>>n;
        memset(Data,0,sizeof(Data));
        for(int i=1;i<=n;i++){
            cin>>num;
            Data[num].time++;
            Data[num].index=i;
        }

        int mindex=-1;
        for(int i=1;i<=n;i++){
            if(Data[i].time==1) {
                mindex=Data[i].index;
                break;
            }
        }
        cout<<mindex<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e5+50;

struct Node{
    int index,time;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;
        cin>>n;
        int minn=200010;

        memset(Data,0,sizeof(Data));
        for(int i=1;i<=n;i++){
            cin>>num;
            Data[num].time++;
            Data[num].index=i;
        }

        int mindex=0;
        for(int i=1;i<=200010;i++){
            if(Data[i].time==1&&i<minn) {
                minn=i;
                mindex=Data[i].index;
                break;
            }
        }

        if(minn==200010) cout<<-1<<endl;
        else cout<<mindex<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
const int maxn=2e5+50;

struct Node{
    int index,time;
}Data[maxn];

int main(){
    int Case;
    cin>>Case;
    while(Case--){
        int n,num;

        cin>>n;
        memset(Data,0,n);
        for(int i=1;i<=n;i++){
            cin>>num;
            Data[num].time++;
            Data[num].index=i;
        }

        int mindex=-1;
        for(int i=1;i<=n;i++){
            if(Data[i].time==1) {
                mindex=Data[i].index;
                break;
            }
        }
        cout<<mindex<<endl;
    }
    return 0;
}


#include<bit/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,f=0;
		cin>>n;
		vector<long long int>v(n);
		map<long long int,long long int>m;
		map<long long int,long long int> ::iterator it;
		for(int i=0; i<n; i++)
		{
			cin>>v[i];
		}

		for(int i=0; i<n; i++)
		{
			m[v[i]]++;
		}

		for(it=m.begin(); it!=m.end(); it++)
		{
			if((*it).second==1)
			{
				int p = (*it).first<<endl;
				f=1;
				break;
			}
		}

		if(f==0)
		{
			cout<<-1<<endl;
		}
		else
		{
			auto it = find(v.begin(), v.end(), p);
			cout<< (it-v.begin())+1;
		}
	}
}


#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,f=0;
		cin>>n;
		vector<int>v(n);
		map<int,int>m;
		map<int,int> ::iterator it;
		for(int i=0; i<n; i++)
		{
			cin>>v[i];
		}

		for(int i=0; i<n; i++)
		{
			m[v[i]]++;
		}

		for(it=m.begin(); it!=m.end(); it++)
		{
			if((*it).second==1)
			{
				cout<<(*it).first<<endl;
				f=1;
				break;
			}
		}

		if(f==0)
		{
			cout<<-1<<endl;
		}
	}
}


#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,f=0;
		cin>>n;
		vector<int>v(n);
		map<int,int>m;
		map<int,int> ::iterator it;
		for(int i=0; i<n; i++)
		{
			cin>>v[i];
		}
		for(int i=0; i<n; i++)
		{
			m[v[i]]++;
		}
	for(it = m.begin(); it!=m.end()l it++)
	{

		if(it->second==1)
		{
			cout<<it->first<<endl;
			f=1;
			break;
		}
	}
	if(f==0)
	{
		cout<<-1<<endl;
	}
}