//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();

            System.out.println(path/cc+(p/cc-n/cc));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();

            System.out.println(path/cc-(n/cc-p/cc));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();
            long newp=n-p;
            long nf=path/cc;
            if(newp<=cc&&cc>=p&&cc<=n)nf--;
            System.out.println(nf-((newp+1)/cc));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();
            long newp=n-p;
            long nf=path/cc;
            if(newp<cc&&cc>=p&&cc<=n)nf--;
            System.out.println(nf-((n-p+1)/cc));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();

            p--;
            System.out.println(path/cc-(n/cc-p/cc));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();
            long newp=n-p;
            long nf=path/cc;
            if(cc%p==0)nf--;
            if (cc%n==0) {
                nf--;
            }
            System.out.println(Math.max((nf-((newp+1)/cc)),0));
        }
    }
}


//6000 KB memory
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

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

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
 ///////////////////////////////////////////////////////////////////////////main
    public static void main(String[] args)
    {
        FastReader in=new FastReader();
       int t=in.nextInt();
        for (int i = 0; i < t; i++) {
            long path=in.nextInt(),cc=in.nextInt(),p=in.nextInt(),n=in.nextInt();
            long newp=n-p;
            long nf=path/cc;
            if(cc%p==0||cc%n==0)nf--;

            System.out.println(Math.max((nf-((newp+1)/cc)),0));
        }
    }
}


//package CodeforcesProject;

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

public class j{

    public static void main(String[] args) throws Exception {
        //input();
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int len = Integer.parseInt(input.readLine());
        for (int i = 0; i<len; i++){
            int [] InputIndex = Arrays.stream(input.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            int size = InputIndex[0];
            int step = InputIndex[1];
            float start = (float) InputIndex[2];
            int stop = InputIndex[3];
            int answer = 0;
            float startIndex = start;
            float check = start % step;
            if (check == 0){
                answer++;
            }else{
                float checktrue = (((int) start / step) + 1) * step;
                if (checktrue <= stop){
                    startIndex = checktrue;
                    answer++;
                }
            }
            int lenSight = stop - (int) startIndex;
            if (lenSight > 0) {
                answer += lenSight / step;
            }
            System.out.println(size/step - answer);
        }
        input.close();

    }
    private static void input() throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        input.close();
    }

}


package CodeforcesProject;

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

public class j{

    public static void main(String[] args) throws Exception {
        //input();
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int len = Integer.parseInt(input.readLine());
        for (int i = 0; i<len; i++){
            int [] InputIndex = Arrays.stream(input.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            int size = InputIndex[0];
            int step = InputIndex[1];
            float start = (float) InputIndex[2];
            int stop = InputIndex[3];
            int answer = 0;
            float startIndex = start;
            float check = start % step;
            if (check == 0){
                answer++;
            }else{
                float checktrue = (((int) start / step) + 1) * step;
                if (checktrue <= stop){
                    startIndex = checktrue;
                    answer++;
                }
            }
            int lenSight = stop - (int) startIndex;
            if (lenSight > 0) {
                answer += lenSight / step;
            }
            System.out.println(size/step - answer);
        }
        input.close();

    }
    private static void input() throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        input.close();
    }

}


//package CodeforcesProject;

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

public class j{

    public static void main(String[] args) throws Exception {
        //input();
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int len = Integer.parseInt(input.readLine());
        for (int i = 0; i<len; i++){
            int [] InputIndex = Arrays.stream(input.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            int size = InputIndex[0];
            int step = InputIndex[1];
            int start = InputIndex[2];
            int stop = InputIndex[3];
            int answer = 0;
            int startIndex = start;
            float check = start % step;
            if (check == 0){
                answer++;
            }else{
                int checktrue = ((start / step) + 1) * step;
                if (checktrue <= stop){
                    startIndex = checktrue;
                    answer++;
                }
            }
            int lenSight = stop - startIndex;
            if (lenSight > 0) {
                answer += lenSight / step;
            }
            System.out.println(size/step - answer);
        }
        input.close();

    }
    private static void input() throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        input.close();
    }

}


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

public class VovaTrain {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int N = sc.nextInt();
        for(int i = 0; i < N; i++) {
            int L = sc.nextInt();
            int V = sc.nextInt();
            int l = sc.nextInt();
            int R = sc.nextInt();
            R-=R%V;
            int sum = (l-1)/V + (L-R)/V;
            sb.append(sum);
            sb.append("\n");
        }
        System.out.print(sb.toString());
    }
}


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

public class VovaTrain {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int N = sc.nextInt();
        for(int i = 0; i < N; i++) {
            int L = sc.nextInt();
            int V = sc.nextInt();
            int l = sc.nextInt();
            int R = sc.nextInt();
            int mult = 1;
            int sum = 0;
            while(mult*V <= L) {
                if (mult*V < l || mult*V > R) {
                    sum++;
                }
                mult++;
            }
            sb.append(sum);
            sb.append("\n");
        }
        System.out.print(sb.toString());
    }
}


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

public class VovaTrain {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int N = sc.nextInt();
        for(int i = 0; i < N; i++) {
            int L = sc.nextInt();
            int V = sc.nextInt();
            int l = sc.nextInt();
            int R = sc.nextInt();
            int mult = 1;
            int sum = 0;
            while(mult*V <= L) {
                if (mult*V < l || mult*V > R) {
                    sum++;
                }
                mult++;
            }
            sb.append(sum);
            sb.append("\n");
        }
        System.out.print(sb.toString());

    }
}


import java.util.*;

public class azzam {
	public static void main(String[] args) {
	Scanner sc=new Scanner (System.in);
	int t=sc.nextInt();
	for (int i=0;i<t;i++){
		int L=sc.nextInt();
		int v=sc.nextInt();
		int l=sc.nextInt();
		int r=sc.nextInt();
		int n=0;
		if (!(v>=l&&L<=r)){
		for(int j=v;j<=L;j+=v){
			if(!(j>=l&&j<=r))
				n++;
		}
			}
		System.out.println(n);

	}

}
	}


import java.util.*;

public class azzam {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for (int i = 0; i < t; i++) {
			int L = sc.nextInt();
			int v = sc.nextInt();
			int l = sc.nextInt()-1;
			int r = sc.nextInt();
			int n = L/v;
			int x = (r/v-l/v);
			System.out.println(n-x);
		}

	}
}


fun main() {
    val t = readInt()
    repeat(t) {
        val n = readInt()
        val a = readInts()
        println(winnerOfUniqueBidAuction(a))
    }
}

fun winnerOfUniqueBidAuction(a: List<Int>): Int {
    val min = a.filter { b -> a.count { it == b } == 1 }.minOrNull()
    return min?.let { a.indexOf(it) + 1 } ?: -1
}

fun readInt(): Int = readLine()!!.toInt()
fun readInts(): List<Int> = readLine()!!.split("\\s+".toRegex()).map { it.toInt() }


fun main() {
    val t = readInt()
    repeat(t) {
        val n = readInt()
        val a = readInts()
        println(winnerOfUniqueBidAuction(a))
    }
}

fun winnerOfUniqueBidAuction(a: List<Int>): Int {
    val min = a.asSequence().withIndex().filter { (index, i) -> a.subList(index+1, a.size).any { it == i} }.minByOrNull { it.value }?.index
    return min?.let { it + 1 } ?: -1
}


fun main() {
    val t = readInt()
    repeat(t) {
        val n = readInt()
        val a = readInts()
        println(winnerOfUniqueBidAuction(a))
    }
}

fun winnerOfUniqueBidAuction(a: List<Int>): Int {
    val min = a.asSequence().withIndex().filter { (index, i) -> a.subList(index+1, a.size).any { it == i} }.minByOrNull { it.value }?.index
    return min?.let { it + 1 } ?: -1
}

fun readInt(): Int = readLine()!!.toInt()
fun readInts(): List<Int> = readLine()!!.split("\\s+".toRegex()).map { it.toInt() }


fun readInt() = readLine()!!.toInt()
fun readInts() = readLine()!!.split(' ').map { it.toInt() }

fun main() {
    repeat(readInt()) {
        readInt()

        val best = sortedMapOf<Int, Int?>()
        for ((i, v) in readInts().withIndex()) {
            if (best.containsKey(v)) {
                best[v] = null
            } else {
                best[v] = i+1
            }
        }

        val num = best.keys.firstOrNull { best[it] != null }
        println(if (num == null) -1 else best[num])
    }
}


import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val fs = BufferedReader(InputStreamReader(System.`in`))
    var t = fs.readLine().toInt()
    loop@for (tt in 1..t) {
        var n = fs.readLine().toInt()
        var a = fs.readLine().split(" ").map { it.toInt() }
        var ans = IntArray(n+1){0}
        for (i in 0 until a.size) {
            if(ans[a[i]] == 0) ans[a[i]] = i+1
            else ans[a[i]] = -1
        }
        for (i in 1 until ans.size) {
            if(ans[i] > 0){
                println(ans[i])
                continue@loop
            }
        }
        println(-1)
    }
}


import java.io.FileInputStream

fun main() {
//    changeStandardInput()
    repeat(readIntLn()) {
        val n = readIntLn()
        val items = readStrings().mapIndexed { index, s ->
            IntPair(s.toInt(), index + 1)
        }.groupBy { it.value }

        var ansIndex = -1
        var ansKey = Int.MAX_VALUE
        for ((key, values) in items) {
            if (values.size == 1) {
                if (key < ansKey) {
                    ansIndex = values[0].index
                    ansKey = key
                }

            }
        }

        println(ansIndex)
    }
}

private data class IntPair(
    val value: Int,
    val index: Int
) : Comparable<IntPair> {
    override fun compareTo(other: IntPair): Int {
        val cmp = value.compareTo(other.value)
        return if (cmp == 0) index.compareTo(other.index) else cmp
    }
}

private fun readLn() = readLine()!!
private fun readIntLn() = readLn().toInt()
private fun readLongLn() = readLn().toLong()
private fun readDoubleLn() = readLn().toDouble()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }
private fun readLongs() = readStrings().map { it.toLong() }

private fun changeStandardInput() {
    System.setIn(FileInputStream("input.txt"))
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author aryssoncf
 */
//object Main {
//    @JvmStatic
    fun main(args: Array<String>) {
        val inputStream = System.`in`
        val outputStream: OutputStream = System.out
        val `in` = InputReader(inputStream)
        val out = OutputWriter(outputStream)
        val solver = BUniqueBidAuction()
        val testCount = `in`.next().toInt()
        for (i in 1..testCount) solver.solve(i, `in`, out)
        out.close()
    }

    internal class BUniqueBidAuction {
        fun solve(testNumber: Int, `in`: InputReader, out: OutputWriter) {
            val n = `in`.readInt()
            val a = `in`.readIntArray(n)
            MiscUtils.decreaseByOne(a)
            val counter = IntArray(n)
            for (x in a) {
                counter[x]++
            }
            val unique = ArrayUtils.find(counter, 1)
            var res = ArrayUtils.find(a, unique)
            if (res != -1) {
                res++
            }
            out.printLine(res)
        }
    }

    internal class InputReader(private val stream: InputStream) {
        private val buf = ByteArray(1024)
        private var curChar = 0
        private var numChars = 0
        private val filter: SpaceCharFilter? = null
        fun readIntArray(size: Int): IntArray {
            val array = IntArray(size)
            for (i in 0 until size) {
                array[i] = readInt()
            }
            return array
        }

        fun read(): Int {
            if (numChars == -1) {
                throw InputMismatchException()
            }
            if (curChar >= numChars) {
                curChar = 0
                numChars = try {
                    stream.read(buf)
                } catch (e: IOException) {
                    throw InputMismatchException()
                }
                if (numChars <= 0) {
                    return -1
                }
            }
            return buf[curChar++].toInt()
        }

        fun readInt(): Int {
            var c = read()
            while (isSpaceChar(c)) {
                c = read()
            }
            var sgn = 1
            if (c == '-'.toInt()) {
                sgn = -1
                c = read()
            }
            var res = 0
            do {
                if (c < '0'.toInt() || c > '9'.toInt()) {
                    throw InputMismatchException()
                }
                res *= 10
                res += c - '0'.toInt()
                c = read()
            } while (!isSpaceChar(c))
            return res * sgn
        }

        fun readString(): String {
            var c = read()
            while (isSpaceChar(c)) {
                c = read()
            }
            val res = StringBuilder()
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c)
                }
                c = read()
            } while (!isSpaceChar(c))
            return res.toString()
        }

        fun isSpaceChar(c: Int): Boolean {
            return filter?.isSpaceChar(c) ?: isWhitespace(c)
        }

        operator fun next(): String {
            return readString()
        }

        interface SpaceCharFilter {
            fun isSpaceChar(ch: Int): Boolean
        }

        companion object {
            fun isWhitespace(c: Int): Boolean {
                return c == ' '.toInt() || c == '\n'.toInt() || c == '\r'.toInt() || c == '\t'.toInt() || c == -1
            }
        }
    }

    internal object ArrayUtils {
        fun range(from: Int, to: Int): IntArray {
            val result = IntArray(Math.max(from, to) - Math.min(from, to))
            if (to >= from) {
                for (i in from until to) {
                    result[i - from] = i
                }
            } else {
                for (i in from downTo to + 1) {
                    result[i - from] = i
                }
            }
            return result
        }

        fun find(array: IntArray, value: Int): Int {
            return Arrays.stream(range(0, array.size)).filter { i: Int -> array[i] == value }.findFirst().orElse(-1)
        }
    }

    internal class OutputWriter {
        private val writer: PrintWriter

        constructor(outputStream: OutputStream?) {
            writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))
        }

        constructor(writer: Writer?) {
            this.writer = PrintWriter(writer)
        }

        fun close() {
            writer.close()
        }

        fun printLine(i: Int) {
            writer.println(i)
        }
    }

    internal object MiscUtils {
        fun decreaseByOne(array: IntArray) {
            for (i in array.indices) {
                array[i]--
            }
        }
    }
//}


fun main() {
    if (System.getProperty("ONLINE_JUDGE") == null) {
        Class.forName("cz.cf.problems.P1454BKt").getDeclaredMethod("testInput").invoke(null)
    }
    repeat(readLine()!!.toInt()) {
        readLine()
        val a = readLine()!!.split(" ").map { it.toInt() }
        val singles = a.groupBy { it }.filter { it.value.size == 1 }
        var v = a.indexOf(singles.keys.minOrNull())
        if (v >=0) {
            v++
        }
        println(v)
    }
}


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

public class Solution{
    public static void main(String args[]) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        while(t-- > 0){
            int n = Integer.parseInt(br.readLine());
            int arr[] = new int[n];

            String in[] = br.readLine().split(" ");

            for(int i = 0; i < n; i++){
                arr[i] = Integer.parseInt(in[i]);
            }

            HashMap<Integer, Integer> freq = new HashMap<>();

            for(int i = 0; i < n; i++){
                if(!freq.containsKey(arr[i])){
                    freq.put(arr[i], 0);
                }

                freq.put(arr[i], freq.get(arr[i]) + 1);
            }

            int min = Integer.MAX_VALUE;

            for(int key: freq.keySet()){
                if(freq.get(key) == 1){
                    min = Math.min(min, key);
                }
            }

            if(min == Integer.MAX_VALUE){
                System.out.println("-1");
            }else{
                System.out.println(min);
            }

        }
    }
}


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

public class Solution{
    public static void main(String args[]) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        while(t-- > 0){
            int n = Integer.parseInt(br.readLine());
            int arr[] = new int[n];

            String in[] = br.readLine().split(" ");

            for(int i = 0; i < n; i++){
                arr[i] = Integer.parseInt(in[i]);
            }

            HashMap<Integer, Integer> freq = new HashMap<>();
            HashMap<Integer, Integer> indexes = new HashMap<>();

            for(int i = 0; i < n; i++){
                if(!indexes.containsKey(arr[i])){
                    indexes.put(arr[i], i);
                }

                if(!freq.containsKey(arr[i])){
                    freq.put(arr[i], 0);
                }

                freq.put(arr[i], freq.get(arr[i]) + 1);
            }

            int min = Integer.MAX_VALUE;
            int minIndex = Integer.MAX_VALUE;

            for(int key: freq.keySet()){
                if(freq.get(key) == 1){
                    if(min > key){
                        min = key;
                        minIndex = indexes.get(key);
                    }
                }
            }

            if(min == Integer.MAX_VALUE){
                System.out.println("-1");
            }else{
                System.out.println(minIndex + 1);
            }

        }
    }
}


import java.util.*;

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

      while(t != 0){
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        int n = in.nextInt();
        int[] arr = new int[n];
        // boolean flag = false;

          for(int i = 0; i<n; i++){
            int a = in.nextInt();
            map.put()
          }
          for(int i = 0; i<n; i++){
            if(arr[i] == 1){
              System.out.println(map.get(i+1) + 1);
              flag = true;
              break;
            }
          }
          if(!flag){
            System.out.println(-1);
          }
        t--;
      }

	}
}


import java.util.*;

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

      while(t != 0){
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        int n = in.nextInt();
        int[] arr = new int[n];
        boolean flag = false;

          for(int i = 0; i<n; i++){
            int a = in.nextInt();
              arr[a-1]++;
              map.put(a, i);
          }
          for(int i = 0; i<n; i++){
            if(arr[i] == 1){
              System.out.println(map.get(i+1) + 1);
              flag = true;
              break;
            }
          }
          if(!flag){
            System.out.println(-1);
          }
        t--;
      }

	}
}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashMap<Integer,Integer>h=new HashMap<>();

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

                arr[i]=sc.nextInt();

             if(h.containsKey(arr[i])){

                h.put(arr[i],h.get(arr[i])+1);
             }else{

                h.put(arr[i],1);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=-1;

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

                if(h.get(arr[i])==1){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

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

              System.out.println(idx+1);

          }

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashSet<Integer>h=new HashSet<>();

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

                arr[i]=sc.nextInt();

             if(h.contains(arr[i])){

                h.remove(arr[i]);

             }else{

                h.add(arr[i]);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=-1;

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

                if(h.contains(arr[i])){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.println(idx);

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashMap<Integer,Integer>h=new HashMap<>();

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

                arr[i]=sc.nextInt();

             if(h.containsKey(arr[i])){

                h.put(arr[i],h.get(arr[i]+1));
             }else{

                h.put(arr[i],1);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=-1;

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

                if(h.get(arr[i])==1){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.println(idx);

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashMap<Integer,Integer>h=new HashMap<>();

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

                arr[i]=sc.nextInt();

             if(h.containsKey(arr[i])){

                h.put(arr[i],h.get(arr[i]+1));
             }else{

                h.put(arr[i],1));
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=-1;

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

                if(h.get(arr[i])==1){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.println(idx);

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashMap<Integer,Integer>h=new HashMap<>();

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

                arr[i]=sc.nextInt();

             if(h.containsKey(arr[i])){

                h.put(arr[i],h.get(arr[i])+1);
             }else{

                h.put(arr[i],1);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=-1;

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

                if(h.get(arr[i])==1){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.println(idx);

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashSet<Integer>h=new HashSet<>();

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

                arr[i]=sc.nextInt();

             if(h.contains(arr[i])){

                h.remove(arr[i]);

             }else{

                h.add(arr[i]);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=0;

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

                if(h.contains(arr[i])){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.print(idx);

        }

    }

}


import java.util.*;

public class sol{

    public static void main(String[]args){

        Scanner sc=new Scanner(System.in);

        int t=sc.nextInt();

        for(int l=0;l<t;l++){

            int n=sc.nextInt();

            int[]arr=new int[n];

            HashSet<Integer>h=new HashSet<>();

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

                arr[i]=sc.nextInt();

             if(h.contains(arr[i])){

                h.remove(arr[i]);

             }else{

                h.add(arr[i]);
             }

            }

            int ans=Integer.MAX_VALUE;

            int idx=0;

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

                if(h.contains(arr[i])){

                    if(ans>arr[i]){

                        ans=arr[i];
                        idx=i;
                    }

                }

            }

            System.out.println(idx);

        }

    }

}


import java.io.*;
import java.util.*;
public class B {
	static PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		int tc=sc.nextInt();
		while(tc-->0) {
			int l=2*(int)Math.pow(10, 5);
			int freq[]=new int[l+5];
			int n=sc.nextInt();
			ArrayList<Integer>list=new ArrayList<>();
			for(int i=0;i<n;i++) {
				int a=sc.nextInt();
				list.add(a);
				freq[a]++;
			}
			int ans=-1;
			for(int i=0;i<freq.length;i++) {
				if(freq[i]==1) {
					ans=i;
					break;
				}
			}
			if(ans==-1)out.println(-1);
			else out.println(list.indexOf(ans)+1);
		}

		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
		public int[] nextIntArr(int n) throws IOException{
			int arr[]=new int[n];
			for(int i=0;i<n;i++)arr[i]=nextInt();
			return arr;
		}

	}
}


import java.io.*;
import java.util.*;
public class B {
	static PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		int tc=sc.nextInt();
		while(tc-->0) {
			int n=sc.nextInt();
			int []freq=new int[n+5];
			int []arr=new int[n+5];
			for(int i=0;i<n;i++) {
				int a=sc.nextInt();
				freq[a]++;
				arr[a]=i+1;
			}
			int ans=-1;
			for(int i=0;i<arr.length;i++) {
				if(freq[i]==1) {
					ans=arr[i];
					break;
				}
			}
			out.println(ans);
		}

		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
		public int[] nextIntArr(int n) throws IOException{
			int arr[]=new int[n];
			for(int i=0;i<n;i++)arr[i]=nextInt();
			return arr;
		}

	}
}


import java.util.HashMap;
import java.util.Map;
import java.util.OptionalInt;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int t = sc.nextInt();
    for (int tc = 0; tc < t; ++tc) {
      int n = sc.nextInt();
      int[] a = new int[n];
      for (int i = 0; i < a.length; ++i) {
        a[i] = sc.nextInt();
      }

      System.out.println(solve(a));
    }

    sc.close();
  }

  static int solve(int[] a) {
    Map<Integer, Integer> valueToCount = new HashMap<>();
    for (int value : a) {
      valueToCount.put(value, valueToCount.getOrDefault(value, 0) + 1);
    }

    OptionalInt minUnique =
        valueToCount.keySet().stream()
            .filter(value -> valueToCount.get(value) == 1)
            .mapToInt(x -> x)
            .min();
    if (!minUnique.isPresent()) {
      return -1;
    }

    return IntStream.range(0, a.length)
            .filter(i -> a[i] == minUnique.getAsInt())
            .findAny()
            .getAsInt()
        + 1;
  }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	static ArrayList<Integer> adj[];

	static int k;
	static int[] a;
	static int b[];
	static int m;

	static class Pair implements Comparable<Pair> {
		long a;
		long b;
		public Pair(long c, long l) {
			a = c;
			b = l;
		}
		@Override
		public int compareTo(Pair o) {
		if(o.a-o.b>this.a-this.b)
			return 1;
		else if(o.a-o.b==this.a-this.b)
			return 0;
		else {
			return -1;
		}
	}
}

	static ArrayList<Pair> adjlist[];
	// static char c[];
	static long mod = (long) (1e9+7);
	static int V;
	static long INF = (long) 1E16;
	static int n;
	static char c[];
	static Pair p[];
static int grid[][];
static class Triple{
	long max;
	int leaves;
	long citizens;
	public Triple(long a,long l,int c) {
		leaves=c;
		max=a;
		citizens=l;
	}
}
static int q;
public static void main(String args[]) throws Exception {
	 Scanner sc = new Scanner(System.in);
	 PrintWriter out = new PrintWriter(System.out);
	 int t=sc.nextInt();
	 label:while(t-->0) {
		int n=sc.nextInt();
		int a[]=new int[n];
		int count[]=new int[(int) (n+1)];
		int idx[]=new int[(int) (n+1)];
		for (int i = 0; i < a.length; i++) {
			a[i]=sc.nextInt();
		idx[a[i]]=i;
		count[a[i]]++;
		}
		for (int i = 0; i <count.length; i++) {
			if(count[i]==1) {
				out.println(idx[i]+1);
			continue label;
			}
		}
		out.println(-1);

	 }
	 out.flush();

}
static int tri[][][];
static String m1="";
static String s;
static int dp(int i,int j ,int state) {
	if(j==m1.length()) {
		return state==1? 1:0;
	}
	if(i==n)
		return 0;
	if(tri[i][j][state]!=-1)
		return tri[i][j][state];
	int ans=0;
	if(m1.charAt(j)==s.charAt(i)) {
		ans=Math.max(ans,dp(i+1,j+1,state));
		ans=Math.max(ans,dp(i+1,j,1));
	}
	else
		ans=Math.max(ans,dp(i+1,j,state));

	return 	 tri[i][j][state]=ans;
}
static int aa;
static int bb;

static long cost[];
static int ans;
static Triple dfs(int u) {
	vis[u]=true;
	int leaves=0;
	long citizens=0;
	long max=0;

	for(int v:adj[u]) {
		if(!vis[v]) {
		Triple t=dfs(v);
		leaves+=t.leaves;
		citizens+=t.citizens;
		max=Math.max(max,t.max);
		}
	}
	if(adj[u].size()!=0) {
		int rem=(citizens+cost[u])%leaves==0?0:1;
		//System.out.println(rem+" "+citizens+" "+leaves+" "+u+" "+cost[u]);
		return new Triple(Math.max(max,rem+((1l*citizens+cost[u])/leaves)),citizens+cost[u],leaves);
	}
	else {
		return new Triple(cost[u],(int) cost[u],1);
	}

}
static void update(int idx,int val) {
	if(idx==0) {
		total-=a[0];
		if(idx+1<a.length)
		total-=Math.max(0,a[idx+1]-a[idx]);
		a[0]=val;
		total+=a[0];
		if(idx+1<a.length)
		total+=Math.max(0,a[idx+1]-a[idx]);

		return;
	}
	if(idx>0) {
		total-=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total-=Math.max(0,a[idx+1]-a[idx]);
	}
	a[idx]=val;
	 if(idx>0) {
		total+=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total+=Math.max(0,a[idx+1]-a[idx]);
	}
}
static int[] compreessarray(int c[]) {
	Stack<Integer> st=new Stack<>();
	for (int i = 0; i < c.length; i++) {
		if(st.isEmpty()||c[i]!=st.peek())
		st.add(c[i]);
	}
	b=new int[st.size()];
	for (int i = b.length-1; i>=0; i--) {
		b[i]=st.pop();
	}
	return b;
}
static int div4[];
static long [] reversearray(long a[]) {
	for (int i = 0; i <a.length/2; i++) {
		long temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static int [] reversearray(int a[]) {
	for (int i = 0; i <=a.length/2; i++) {
		int temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static class SegmentTree {		// 1-based DS, OOP

	int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
	int[] array, sTree, lazy;

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

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

	void update_point(int index, int val)			// O(log n)
	{
		index += N - 1;
		sTree[index]= val;
		while(index>1)
		{
			index >>= 1;
			sTree[index] = gcd(sTree[index<<1],sTree[index<<1|1]);
	    }
	}
	int query(int i, int j,int x)
	{
		return query(1,1,N,i,j,0,x);
	}

	int query(int node, int b, int e, int i, int j,int ans,int x)	// O(log n)
	{
		if(i>e || j <b)
			return 0;
		if(b>= i && e <= j) {
			if(sTree[node]%x==0)
			return ans;
			else {
				while(node<N) {
				 if (sTree[node<<1]% x!= 0) {
			          if (sTree[node<<1|1] % x != 0) {
			            ans= 2;
			            return ans;
			          }
			          node = node<<1;
			        } else {
			          node= node<<1|1;
			        }
				}
				ans++;
				return ans;
			}
		}
		int mid = b + e >> 1;
		//propagate(node, b, mid, e);
		int q1 = query(node<<1,b,mid,i,j,ans,x);
		int q2 = query(node<<1|1,mid+1,e,i,j,ans,x);
		return q1+q2;

	}
}
static  TreeSet<Integer> ts=new TreeSet();
static HashMap<Integer, Integer> compress(int a[]) {
		 ts = new TreeSet<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : a)
			ts.add(x);
		for (int x : ts) {
			hm.put(x, hm.size() + 1);
		}
		return hm;
	}

	static  class FenwickTree { // one-based DS

		int n;
		int[] ft;

		FenwickTree(int size) { n = size; ft = new int[n+1]; }

		int rsq(int b) //O(log n)
		{
			int sum = 0;
			while(b > 0) { sum += ft[b]; b -= b & -b;}		//min?
			return sum;
		}

		int rsq(int a, int b) { return rsq(b) - rsq(a-1); }

		void point_update(int k, int val)	//O(log n), update = increment
		{
			while(k <= n) { ft[k] += val; k += k & -k; }		//min?
		}
	}
	static ArrayList<Integer> euler=new ArrayList<>();

	static ArrayList<Integer> arr;

static long total;
static TreeMap<Integer,Integer> map1;

		static int zz;
//static int dp(int idx,int left,int state) {
//if(idx>=k-((zz-left)*2)||idx+1==n) {
//	return 0;
//}
//if(memo[idx][left][state]!=-1) {
//	return memo[idx][left][state];
//}
//int ans=a[idx+1]+dp(idx+1,left,0);
//if(left>0&&state==0&&idx>0) {
//	ans=Math.max(ans,a[idx-1]+dp(idx-1,left-1,1));
//}
//return memo[idx][left][state]=ans;
//}21
static HashMap<Integer,Integer> map;
static int maxa=0;
static int ff=123123;

static int[][] memo;

	static long modmod=998244353;
	static int dx[]= {1,-1,0,0};
	 static int dy[]= {0,0,1,-1};
	static class BBOOK implements Comparable<BBOOK>{
		int t;
		int alice;
		int bob;
		public BBOOK(int x,int y,int z) {
		t=x;
		alice=y;
		bob=z;
		}
		@Override
		public int compareTo(BBOOK o) {
			return this.t-o.t;
		}
	}

	static class Edge implements Comparable<Edge>
	{
		int node;long cost ; long time;

		Edge(int a, long b,long c) { node = a;	cost = b; time=c; }

		public int compareTo(Edge e){ return Long.compare(time,e.time);	}
	}

        static void sieve(int N)	// O(N log log N)
	{
		isComposite = new int[N+1];
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}
	}
    static TreeSet<Integer> factors;
    static TreeSet<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
	{
		 factors = new TreeSet<Integer>();		//take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while(1l*p * p <= N)
		{
			while(N % p == 0) { factors.add(p); N /= p; }
			p = primes.get(++idx);
		}

		if(N != 1)						// last prime factor may be > sqrt(N)
			factors.add(N);				// for integers whose largest prime factor has a power of 1
		return factors;
	}

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;
		int max[];

		public UnionFind(int N) {
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}
		public int chunion(int i,int j, int x2) {
			if (isSameSet(i, j))
				return 0;
			numSets--;
			int x = findSet(i), y = findSet(j);
			int z=findSet(x2);
			p[x]=z;;
			p[y]=z;
		return x;
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];

			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;

			}
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	static class Quad implements Comparable<Quad> {
		int u;
		int v;
		char state;
		int turns;

		public Quad(int i, int j, char c, int k) {
			u = i;
			v = j;
			state = c;
			turns = k;
		}

		public int compareTo(Quad e) {
			return (int) (turns - e.turns);
		}

	}

	static long manhatandistance(long x, long x2, long y, long y2) {
		return Math.abs(x - x2) + Math.abs(y - y2);
	}

	static long fib[];

	static long fib(int n) {
		if (n == 1 || n == 0) {
			return 1;
		}
		if (fib[n] != -1) {
			return fib[n];
		} else
			return fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);
	}

	static class Point  implements Comparable<Point>{
		long x, y;

		Point(long counth, long counts) {
			x = counth;
			y = counts;
		}

		@Override
		public int compareTo(Point p )
		{
			return Long.compare(p.y*1l*x, p.x*1l*y);
		}
	}

	static TreeSet<Long> primeFactors(long N) // O(sqrt(N) / ln sqrt(N))
	{
		TreeSet<Long> factors = new TreeSet<Long>(); // take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * p <= N) {
			while (N % p == 0) {
				factors.add((long) p);
				N /= p;
			}
			if (primes.size() > idx + 1)
				p = primes.get(++idx);
			else
				break;
		}

		if (N != 1) // last prime factor may be > sqrt(N)
			factors.add(N); // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static boolean visited[];

	/**
	 * static int bfs(int s) { Queue<Integer> q = new LinkedList<Integer>();
	 * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;
	 * while(!q.isEmpty()) {
	 *
	 * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {
	 * maxcost=Math.max(maxcost, v.cost);
	 *
	 *
	 *
	 * if(!visited[v.v]) {
	 *
	 * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,
	 * v.cost); } }
	 *
	 * } return maxcost; }
	 **/

	static boolean[] vis2;

	static boolean f2 = false;

	static long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x
																			// r)
	{
		long[][] C = new long[p][r];
		for (int i = 0; i < p; ++i) {
			for (int j = 0; j < r; ++j) {
				for (int k = 0; k < q; ++k) {
					C[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;
					C[i][j] %= mod;
				}

			}
		}
		return C;
	}
	public static int[] schuffle(int[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			int temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static boolean vis[];
	static HashSet<Integer> set = new HashSet<Integer>();

	static long modPow(long ways, long count, long mod) // O(log e)
	{
		ways %= mod;
		long res = 1;
		while (count > 0) {
			if ((count & 1) == 1)
				res = (res * ways) % mod;
			ways = (ways * ways) % mod;
			count >>= 1;
		}
		return res % mod;
	}

	static int gcd(int l, int o) {
		if (o == 0) {
			return l;
		}
		return gcd(o, l % o);
	}

	static int[] isComposite;
	static int[] valid;

	static ArrayList<Integer> primes;
	static ArrayList<Integer> l1;

	static TreeSet<Integer> primus = new TreeSet<Integer>();

	static void sieveLinear(int N)
	{
		int[] lp = new int[N + 1];								//lp[i] = least prime divisor of i
		for(int i = 2; i <= N; ++i)
		{
			if(lp[i] == 0)
			{
				primus.add(i);
				lp[i] = i;
			}
			int curLP = lp[i];
			for(int p: primus)
				if(p > curLP || p * i > N)
					break;
				else
					lp[p * i] = i;
		}
	}

	public static long[] schuffle(long[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			long temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}

		public int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}

	}
	public static int[] sortarray(int a[]) {
		schuffle(a);
		Arrays.sort(a);
		return a;
		}
		public static long[] sortarray(long a[]) {
			schuffle(a);
			Arrays.sort(a);
			return a;
		}

}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	static ArrayList<Integer> adj[];

	static int k;
	static int[] a;
	static int b[];
	static int m;

	static class Pair implements Comparable<Pair> {
		long a;
		long b;
		public Pair(long c, long l) {
			a = c;
			b = l;
		}
		@Override
		public int compareTo(Pair o) {
		if(o.a-o.b>this.a-this.b)
			return 1;
		else if(o.a-o.b==this.a-this.b)
			return 0;
		else {
			return -1;
		}
	}
}

	static ArrayList<Pair> adjlist[];
	// static char c[];
	static long mod = (long) (1e9+7);
	static int V;
	static long INF = (long) 1E16;
	static int n;
	static char c[];
	static Pair p[];
static int grid[][];
static class Triple{
	long max;
	int leaves;
	long citizens;
	public Triple(long a,long l,int c) {
		leaves=c;
		max=a;
		citizens=l;
	}
}
static int q;
public static void main(String args[]) throws Exception {
	 Scanner sc = new Scanner(System.in);
	 PrintWriter out = new PrintWriter(System.out);
	 int t=sc.nextInt();
	 label:while(t-->0) {
		int n=sc.nextInt();
		int a[]=new int[n];
		TreeMap<Integer,Integer> map=new TreeMap<Integer, Integer>();
		int idx[]=new int[(int) (2e5+1)];
		for (int i = 0; i < a.length; i++) {
			a[i]=sc.nextInt();
			map.put(a[i],map.getOrDefault(a[i],0)+1);
		idx[a[i]]=i;
		}
		for(Map.Entry<Integer, Integer> e:map.entrySet()) {
			if(e.getValue()==1) {
				System.out.println(idx[e.getKey()]+1);
			continue label;
			}
		}
		System.out.println(-1);

	 }
	 out.flush();

}
static int tri[][][];
static String m1="";
static String s;
static int dp(int i,int j ,int state) {
	if(j==m1.length()) {
		return state==1? 1:0;
	}
	if(i==n)
		return 0;
	if(tri[i][j][state]!=-1)
		return tri[i][j][state];
	int ans=0;
	if(m1.charAt(j)==s.charAt(i)) {
		ans=Math.max(ans,dp(i+1,j+1,state));
		ans=Math.max(ans,dp(i+1,j,1));
	}
	else
		ans=Math.max(ans,dp(i+1,j,state));

	return 	 tri[i][j][state]=ans;
}
static int aa;
static int bb;

static long cost[];
static int ans;
static Triple dfs(int u) {
	vis[u]=true;
	int leaves=0;
	long citizens=0;
	long max=0;

	for(int v:adj[u]) {
		if(!vis[v]) {
		Triple t=dfs(v);
		leaves+=t.leaves;
		citizens+=t.citizens;
		max=Math.max(max,t.max);
		}
	}
	if(adj[u].size()!=0) {
		int rem=(citizens+cost[u])%leaves==0?0:1;
		//System.out.println(rem+" "+citizens+" "+leaves+" "+u+" "+cost[u]);
		return new Triple(Math.max(max,rem+((1l*citizens+cost[u])/leaves)),citizens+cost[u],leaves);
	}
	else {
		return new Triple(cost[u],(int) cost[u],1);
	}

}
static void update(int idx,int val) {
	if(idx==0) {
		total-=a[0];
		if(idx+1<a.length)
		total-=Math.max(0,a[idx+1]-a[idx]);
		a[0]=val;
		total+=a[0];
		if(idx+1<a.length)
		total+=Math.max(0,a[idx+1]-a[idx]);

		return;
	}
	if(idx>0) {
		total-=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total-=Math.max(0,a[idx+1]-a[idx]);
	}
	a[idx]=val;
	 if(idx>0) {
		total+=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total+=Math.max(0,a[idx+1]-a[idx]);
	}
}
static int[] compreessarray(int c[]) {
	Stack<Integer> st=new Stack<>();
	for (int i = 0; i < c.length; i++) {
		if(st.isEmpty()||c[i]!=st.peek())
		st.add(c[i]);
	}
	b=new int[st.size()];
	for (int i = b.length-1; i>=0; i--) {
		b[i]=st.pop();
	}
	return b;
}
static int div4[];
static long [] reversearray(long a[]) {
	for (int i = 0; i <a.length/2; i++) {
		long temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static int [] reversearray(int a[]) {
	for (int i = 0; i <=a.length/2; i++) {
		int temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static class SegmentTree {		// 1-based DS, OOP

	int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
	int[] array, sTree, lazy;

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

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

	void update_point(int index, int val)			// O(log n)
	{
		index += N - 1;
		sTree[index]= val;
		while(index>1)
		{
			index >>= 1;
			sTree[index] = gcd(sTree[index<<1],sTree[index<<1|1]);
	    }
	}
	int query(int i, int j,int x)
	{
		return query(1,1,N,i,j,0,x);
	}

	int query(int node, int b, int e, int i, int j,int ans,int x)	// O(log n)
	{
		if(i>e || j <b)
			return 0;
		if(b>= i && e <= j) {
			if(sTree[node]%x==0)
			return ans;
			else {
				while(node<N) {
				 if (sTree[node<<1]% x!= 0) {
			          if (sTree[node<<1|1] % x != 0) {
			            ans= 2;
			            return ans;
			          }
			          node = node<<1;
			        } else {
			          node= node<<1|1;
			        }
				}
				ans++;
				return ans;
			}
		}
		int mid = b + e >> 1;
		//propagate(node, b, mid, e);
		int q1 = query(node<<1,b,mid,i,j,ans,x);
		int q2 = query(node<<1|1,mid+1,e,i,j,ans,x);
		return q1+q2;

	}
}
static  TreeSet<Integer> ts=new TreeSet();
static HashMap<Integer, Integer> compress(int a[]) {
		 ts = new TreeSet<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : a)
			ts.add(x);
		for (int x : ts) {
			hm.put(x, hm.size() + 1);
		}
		return hm;
	}

	static  class FenwickTree { // one-based DS

		int n;
		int[] ft;

		FenwickTree(int size) { n = size; ft = new int[n+1]; }

		int rsq(int b) //O(log n)
		{
			int sum = 0;
			while(b > 0) { sum += ft[b]; b -= b & -b;}		//min?
			return sum;
		}

		int rsq(int a, int b) { return rsq(b) - rsq(a-1); }

		void point_update(int k, int val)	//O(log n), update = increment
		{
			while(k <= n) { ft[k] += val; k += k & -k; }		//min?
		}
	}
	static ArrayList<Integer> euler=new ArrayList<>();

	static ArrayList<Integer> arr;

static long total;
static TreeMap<Integer,Integer> map1;

		static int zz;
//static int dp(int idx,int left,int state) {
//if(idx>=k-((zz-left)*2)||idx+1==n) {
//	return 0;
//}
//if(memo[idx][left][state]!=-1) {
//	return memo[idx][left][state];
//}
//int ans=a[idx+1]+dp(idx+1,left,0);
//if(left>0&&state==0&&idx>0) {
//	ans=Math.max(ans,a[idx-1]+dp(idx-1,left-1,1));
//}
//return memo[idx][left][state]=ans;
//}21
static HashMap<Integer,Integer> map;
static int maxa=0;
static int ff=123123;

static int[][] memo;

	static long modmod=998244353;
	static int dx[]= {1,-1,0,0};
	 static int dy[]= {0,0,1,-1};
	static class BBOOK implements Comparable<BBOOK>{
		int t;
		int alice;
		int bob;
		public BBOOK(int x,int y,int z) {
		t=x;
		alice=y;
		bob=z;
		}
		@Override
		public int compareTo(BBOOK o) {
			return this.t-o.t;
		}
	}

	static class Edge implements Comparable<Edge>
	{
		int node;long cost ; long time;

		Edge(int a, long b,long c) { node = a;	cost = b; time=c; }

		public int compareTo(Edge e){ return Long.compare(time,e.time);	}
	}

        static void sieve(int N)	// O(N log log N)
	{
		isComposite = new int[N+1];
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}
	}
    static TreeSet<Integer> factors;
    static TreeSet<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
	{
		 factors = new TreeSet<Integer>();		//take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while(1l*p * p <= N)
		{
			while(N % p == 0) { factors.add(p); N /= p; }
			p = primes.get(++idx);
		}

		if(N != 1)						// last prime factor may be > sqrt(N)
			factors.add(N);				// for integers whose largest prime factor has a power of 1
		return factors;
	}

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;
		int max[];

		public UnionFind(int N) {
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}
		public int chunion(int i,int j, int x2) {
			if (isSameSet(i, j))
				return 0;
			numSets--;
			int x = findSet(i), y = findSet(j);
			int z=findSet(x2);
			p[x]=z;;
			p[y]=z;
		return x;
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];

			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;

			}
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	static class Quad implements Comparable<Quad> {
		int u;
		int v;
		char state;
		int turns;

		public Quad(int i, int j, char c, int k) {
			u = i;
			v = j;
			state = c;
			turns = k;
		}

		public int compareTo(Quad e) {
			return (int) (turns - e.turns);
		}

	}

	static long manhatandistance(long x, long x2, long y, long y2) {
		return Math.abs(x - x2) + Math.abs(y - y2);
	}

	static long fib[];

	static long fib(int n) {
		if (n == 1 || n == 0) {
			return 1;
		}
		if (fib[n] != -1) {
			return fib[n];
		} else
			return fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);
	}

	static class Point  implements Comparable<Point>{
		long x, y;

		Point(long counth, long counts) {
			x = counth;
			y = counts;
		}

		@Override
		public int compareTo(Point p )
		{
			return Long.compare(p.y*1l*x, p.x*1l*y);
		}
	}

	static TreeSet<Long> primeFactors(long N) // O(sqrt(N) / ln sqrt(N))
	{
		TreeSet<Long> factors = new TreeSet<Long>(); // take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * p <= N) {
			while (N % p == 0) {
				factors.add((long) p);
				N /= p;
			}
			if (primes.size() > idx + 1)
				p = primes.get(++idx);
			else
				break;
		}

		if (N != 1) // last prime factor may be > sqrt(N)
			factors.add(N); // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static boolean visited[];

	/**
	 * static int bfs(int s) { Queue<Integer> q = new LinkedList<Integer>();
	 * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;
	 * while(!q.isEmpty()) {
	 *
	 * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {
	 * maxcost=Math.max(maxcost, v.cost);
	 *
	 *
	 *
	 * if(!visited[v.v]) {
	 *
	 * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,
	 * v.cost); } }
	 *
	 * } return maxcost; }
	 **/

	static boolean[] vis2;

	static boolean f2 = false;

	static long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x
																			// r)
	{
		long[][] C = new long[p][r];
		for (int i = 0; i < p; ++i) {
			for (int j = 0; j < r; ++j) {
				for (int k = 0; k < q; ++k) {
					C[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;
					C[i][j] %= mod;
				}

			}
		}
		return C;
	}
	public static int[] schuffle(int[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			int temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static boolean vis[];
	static HashSet<Integer> set = new HashSet<Integer>();

	static long modPow(long ways, long count, long mod) // O(log e)
	{
		ways %= mod;
		long res = 1;
		while (count > 0) {
			if ((count & 1) == 1)
				res = (res * ways) % mod;
			ways = (ways * ways) % mod;
			count >>= 1;
		}
		return res % mod;
	}

	static int gcd(int l, int o) {
		if (o == 0) {
			return l;
		}
		return gcd(o, l % o);
	}

	static int[] isComposite;
	static int[] valid;

	static ArrayList<Integer> primes;
	static ArrayList<Integer> l1;

	static TreeSet<Integer> primus = new TreeSet<Integer>();

	static void sieveLinear(int N)
	{
		int[] lp = new int[N + 1];								//lp[i] = least prime divisor of i
		for(int i = 2; i <= N; ++i)
		{
			if(lp[i] == 0)
			{
				primus.add(i);
				lp[i] = i;
			}
			int curLP = lp[i];
			for(int p: primus)
				if(p > curLP || p * i > N)
					break;
				else
					lp[p * i] = i;
		}
	}

	public static long[] schuffle(long[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			long temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}

		public int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}

	}
	public static int[] sortarray(int a[]) {
		schuffle(a);
		Arrays.sort(a);
		return a;
		}
		public static long[] sortarray(long a[]) {
			schuffle(a);
			Arrays.sort(a);
			return a;
		}

}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	static ArrayList<Integer> adj[];

	static int k;
	static int[] a;
	static int b[];
	static int m;

	static class Pair implements Comparable<Pair> {
		long a;
		long b;
		public Pair(long c, long l) {
			a = c;
			b = l;
		}
		@Override
		public int compareTo(Pair o) {
		if(o.a-o.b>this.a-this.b)
			return 1;
		else if(o.a-o.b==this.a-this.b)
			return 0;
		else {
			return -1;
		}
	}
}

	static ArrayList<Pair> adjlist[];
	// static char c[];
	static long mod = (long) (1e9+7);
	static int V;
	static long INF = (long) 1E16;
	static int n;
	static char c[];
	static Pair p[];
static int grid[][];
static class Triple{
	long max;
	int leaves;
	long citizens;
	public Triple(long a,long l,int c) {
		leaves=c;
		max=a;
		citizens=l;
	}
}
static int q;
public static void main(String args[]) throws Exception {
	 Scanner sc = new Scanner(System.in);
	 PrintWriter out = new PrintWriter(System.out);
	 int t=sc.nextInt();
	 label:while(t-->0) {
		int n=sc.nextInt();
		int a[]=new int[n];
		int count[]=new int[(int) (2e5+1)];
		int idx[]=new int[(int) (2e5+1)];
		for (int i = 0; i < a.length; i++) {
			a[i]=sc.nextInt();
		idx[a[i]]=i;
		count[a[i]]++;
		}
		for (int i = 0; i <count.length; i++) {
			if(count[i]==1) {
				out.println(idx[i]+1);
			continue label;
			}
		}
		out.println(-1);

	 }
	 out.flush();

}
static int tri[][][];
static String m1="";
static String s;
static int dp(int i,int j ,int state) {
	if(j==m1.length()) {
		return state==1? 1:0;
	}
	if(i==n)
		return 0;
	if(tri[i][j][state]!=-1)
		return tri[i][j][state];
	int ans=0;
	if(m1.charAt(j)==s.charAt(i)) {
		ans=Math.max(ans,dp(i+1,j+1,state));
		ans=Math.max(ans,dp(i+1,j,1));
	}
	else
		ans=Math.max(ans,dp(i+1,j,state));

	return 	 tri[i][j][state]=ans;
}
static int aa;
static int bb;

static long cost[];
static int ans;
static Triple dfs(int u) {
	vis[u]=true;
	int leaves=0;
	long citizens=0;
	long max=0;

	for(int v:adj[u]) {
		if(!vis[v]) {
		Triple t=dfs(v);
		leaves+=t.leaves;
		citizens+=t.citizens;
		max=Math.max(max,t.max);
		}
	}
	if(adj[u].size()!=0) {
		int rem=(citizens+cost[u])%leaves==0?0:1;
		//System.out.println(rem+" "+citizens+" "+leaves+" "+u+" "+cost[u]);
		return new Triple(Math.max(max,rem+((1l*citizens+cost[u])/leaves)),citizens+cost[u],leaves);
	}
	else {
		return new Triple(cost[u],(int) cost[u],1);
	}

}
static void update(int idx,int val) {
	if(idx==0) {
		total-=a[0];
		if(idx+1<a.length)
		total-=Math.max(0,a[idx+1]-a[idx]);
		a[0]=val;
		total+=a[0];
		if(idx+1<a.length)
		total+=Math.max(0,a[idx+1]-a[idx]);

		return;
	}
	if(idx>0) {
		total-=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total-=Math.max(0,a[idx+1]-a[idx]);
	}
	a[idx]=val;
	 if(idx>0) {
		total+=Math.max(0,a[idx]-a[idx-1]);
	}
	 if(idx+1<a.length) {
		total+=Math.max(0,a[idx+1]-a[idx]);
	}
}
static int[] compreessarray(int c[]) {
	Stack<Integer> st=new Stack<>();
	for (int i = 0; i < c.length; i++) {
		if(st.isEmpty()||c[i]!=st.peek())
		st.add(c[i]);
	}
	b=new int[st.size()];
	for (int i = b.length-1; i>=0; i--) {
		b[i]=st.pop();
	}
	return b;
}
static int div4[];
static long [] reversearray(long a[]) {
	for (int i = 0; i <a.length/2; i++) {
		long temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static int [] reversearray(int a[]) {
	for (int i = 0; i <=a.length/2; i++) {
		int temp=a[i];
		a[i]=a[a.length-i-1];
		a[a.length-i-1]=temp;
	}
	return a;
}
static class SegmentTree {		// 1-based DS, OOP

	int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
	int[] array, sTree, lazy;

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

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

	void update_point(int index, int val)			// O(log n)
	{
		index += N - 1;
		sTree[index]= val;
		while(index>1)
		{
			index >>= 1;
			sTree[index] = gcd(sTree[index<<1],sTree[index<<1|1]);
	    }
	}
	int query(int i, int j,int x)
	{
		return query(1,1,N,i,j,0,x);
	}

	int query(int node, int b, int e, int i, int j,int ans,int x)	// O(log n)
	{
		if(i>e || j <b)
			return 0;
		if(b>= i && e <= j) {
			if(sTree[node]%x==0)
			return ans;
			else {
				while(node<N) {
				 if (sTree[node<<1]% x!= 0) {
			          if (sTree[node<<1|1] % x != 0) {
			            ans= 2;
			            return ans;
			          }
			          node = node<<1;
			        } else {
			          node= node<<1|1;
			        }
				}
				ans++;
				return ans;
			}
		}
		int mid = b + e >> 1;
		//propagate(node, b, mid, e);
		int q1 = query(node<<1,b,mid,i,j,ans,x);
		int q2 = query(node<<1|1,mid+1,e,i,j,ans,x);
		return q1+q2;

	}
}
static  TreeSet<Integer> ts=new TreeSet();
static HashMap<Integer, Integer> compress(int a[]) {
		 ts = new TreeSet<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : a)
			ts.add(x);
		for (int x : ts) {
			hm.put(x, hm.size() + 1);
		}
		return hm;
	}

	static  class FenwickTree { // one-based DS

		int n;
		int[] ft;

		FenwickTree(int size) { n = size; ft = new int[n+1]; }

		int rsq(int b) //O(log n)
		{
			int sum = 0;
			while(b > 0) { sum += ft[b]; b -= b & -b;}		//min?
			return sum;
		}

		int rsq(int a, int b) { return rsq(b) - rsq(a-1); }

		void point_update(int k, int val)	//O(log n), update = increment
		{
			while(k <= n) { ft[k] += val; k += k & -k; }		//min?
		}
	}
	static ArrayList<Integer> euler=new ArrayList<>();

	static ArrayList<Integer> arr;

static long total;
static TreeMap<Integer,Integer> map1;

		static int zz;
//static int dp(int idx,int left,int state) {
//if(idx>=k-((zz-left)*2)||idx+1==n) {
//	return 0;
//}
//if(memo[idx][left][state]!=-1) {
//	return memo[idx][left][state];
//}
//int ans=a[idx+1]+dp(idx+1,left,0);
//if(left>0&&state==0&&idx>0) {
//	ans=Math.max(ans,a[idx-1]+dp(idx-1,left-1,1));
//}
//return memo[idx][left][state]=ans;
//}21
static HashMap<Integer,Integer> map;
static int maxa=0;
static int ff=123123;

static int[][] memo;

	static long modmod=998244353;
	static int dx[]= {1,-1,0,0};
	 static int dy[]= {0,0,1,-1};
	static class BBOOK implements Comparable<BBOOK>{
		int t;
		int alice;
		int bob;
		public BBOOK(int x,int y,int z) {
		t=x;
		alice=y;
		bob=z;
		}
		@Override
		public int compareTo(BBOOK o) {
			return this.t-o.t;
		}
	}

	static class Edge implements Comparable<Edge>
	{
		int node;long cost ; long time;

		Edge(int a, long b,long c) { node = a;	cost = b; time=c; }

		public int compareTo(Edge e){ return Long.compare(time,e.time);	}
	}

        static void sieve(int N)	// O(N log log N)
	{
		isComposite = new int[N+1];
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}
	}
    static TreeSet<Integer> factors;
    static TreeSet<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
	{
		 factors = new TreeSet<Integer>();		//take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while(1l*p * p <= N)
		{
			while(N % p == 0) { factors.add(p); N /= p; }
			p = primes.get(++idx);
		}

		if(N != 1)						// last prime factor may be > sqrt(N)
			factors.add(N);				// for integers whose largest prime factor has a power of 1
		return factors;
	}

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;
		int max[];

		public UnionFind(int N) {
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}
		public int chunion(int i,int j, int x2) {
			if (isSameSet(i, j))
				return 0;
			numSets--;
			int x = findSet(i), y = findSet(j);
			int z=findSet(x2);
			p[x]=z;;
			p[y]=z;
		return x;
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];

			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;

			}
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	static class Quad implements Comparable<Quad> {
		int u;
		int v;
		char state;
		int turns;

		public Quad(int i, int j, char c, int k) {
			u = i;
			v = j;
			state = c;
			turns = k;
		}

		public int compareTo(Quad e) {
			return (int) (turns - e.turns);
		}

	}

	static long manhatandistance(long x, long x2, long y, long y2) {
		return Math.abs(x - x2) + Math.abs(y - y2);
	}

	static long fib[];

	static long fib(int n) {
		if (n == 1 || n == 0) {
			return 1;
		}
		if (fib[n] != -1) {
			return fib[n];
		} else
			return fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);
	}

	static class Point  implements Comparable<Point>{
		long x, y;

		Point(long counth, long counts) {
			x = counth;
			y = counts;
		}

		@Override
		public int compareTo(Point p )
		{
			return Long.compare(p.y*1l*x, p.x*1l*y);
		}
	}

	static TreeSet<Long> primeFactors(long N) // O(sqrt(N) / ln sqrt(N))
	{
		TreeSet<Long> factors = new TreeSet<Long>(); // take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * p <= N) {
			while (N % p == 0) {
				factors.add((long) p);
				N /= p;
			}
			if (primes.size() > idx + 1)
				p = primes.get(++idx);
			else
				break;
		}

		if (N != 1) // last prime factor may be > sqrt(N)
			factors.add(N); // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static boolean visited[];

	/**
	 * static int bfs(int s) { Queue<Integer> q = new LinkedList<Integer>();
	 * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;
	 * while(!q.isEmpty()) {
	 *
	 * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {
	 * maxcost=Math.max(maxcost, v.cost);
	 *
	 *
	 *
	 * if(!visited[v.v]) {
	 *
	 * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,
	 * v.cost); } }
	 *
	 * } return maxcost; }
	 **/

	static boolean[] vis2;

	static boolean f2 = false;

	static long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x
																			// r)
	{
		long[][] C = new long[p][r];
		for (int i = 0; i < p; ++i) {
			for (int j = 0; j < r; ++j) {
				for (int k = 0; k < q; ++k) {
					C[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;
					C[i][j] %= mod;
				}

			}
		}
		return C;
	}
	public static int[] schuffle(int[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			int temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static boolean vis[];
	static HashSet<Integer> set = new HashSet<Integer>();

	static long modPow(long ways, long count, long mod) // O(log e)
	{
		ways %= mod;
		long res = 1;
		while (count > 0) {
			if ((count & 1) == 1)
				res = (res * ways) % mod;
			ways = (ways * ways) % mod;
			count >>= 1;
		}
		return res % mod;
	}

	static int gcd(int l, int o) {
		if (o == 0) {
			return l;
		}
		return gcd(o, l % o);
	}

	static int[] isComposite;
	static int[] valid;

	static ArrayList<Integer> primes;
	static ArrayList<Integer> l1;

	static TreeSet<Integer> primus = new TreeSet<Integer>();

	static void sieveLinear(int N)
	{
		int[] lp = new int[N + 1];								//lp[i] = least prime divisor of i
		for(int i = 2; i <= N; ++i)
		{
			if(lp[i] == 0)
			{
				primus.add(i);
				lp[i] = i;
			}
			int curLP = lp[i];
			for(int p: primus)
				if(p > curLP || p * i > N)
					break;
				else
					lp[p * i] = i;
		}
	}

	public static long[] schuffle(long[] a2) {
		for (int i = 0; i < a2.length; i++) {
			int x =  (int) (Math.random() * a2.length);
			long temp = a2[x];
			a2[x] = a2[i];
			a2[i] = temp;
		}
		return a2;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}

		public int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}

	}
	public static int[] sortarray(int a[]) {
		schuffle(a);
		Arrays.sort(a);
		return a;
		}
		public static long[] sortarray(long a[]) {
			schuffle(a);
			Arrays.sort(a);
			return a;
		}

}


/*package whatever //do not write package name here */

import java.lang.*;
import java.util.*;

public class UniqueBidAuction{
    public static void main(String[] args){
        Scanner scan= new Scanner(System.in);
        int test=scan.nextInt();

        for(int t=1;t<=test;t++){
            int nop=scan.nextInt();
            int[] unique= new int[nop];
            int[] a= new int[nop];

            for(int i=0;i<nop;i++){
                unique[i]=scan.nextInt();
                a[i]=unique[i];
            }
            Arrays.sort(a);

            int uniquebid=-1;
            if(nop==1)
                uniquebid=a[0];
            else if(a[0]!=a[1])
                uniquebid=a[0];
            else{
                for(int i=1;i<nop-1;i++){
                    if(a[i]!=a[i-1] && a[i]!=a[i+1]){
                        uniquebid=a[i];
                        break;
                    }
                }
            }

            if(uniquebid==-1 && a[nop-1]!=a[nop-2])
                uniquebid=a[nop-1];

            int index=-1;
            if(uniquebid==-1)
                index=-1;
            if(nop==1)
                index=1;
            else{
                for(int i=0;i<nop;i++){
                    if(unique[i]==uniquebid){
                        index=i+1;
                        break;
                    }
                }
            }

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


/*package whatever //do not write package name here */

import java.lang.*;
import java.util.*;

public class UniqueBidAuction{
    public static void main(String[] args){
        Scanner scan= new Scanner(System.in);
        int test=scan.nextInt();

        for(int t=1;t<=test;t++){
            int nop=scan.nextInt();
            int[] unique= new int[nop];
            int[] freq= new int[nop];
            int index=-1,value=-1;

            for(int i=0;i<nop;i++){
                unique[i]=scan.nextInt();
                freq[unique[i]-1]++;
            }

            for(int i=0;i<nop;i++){
                if(freq[i]==1){
                    value=i+1;
                    break;
                }
            }

            if(value==-1)
                index=-1;
            else{
                for(int i=0;i<nop;i++){
                    if(unique[i]==value){
                        index=i+1;
                        break;
                    }
                }
            }

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


import javafx.beans.binding.StringBinding;

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

public class Main {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    }
}