1
3
5 3 4
 6
5
5 3 4 4 5
3
1 1 1
5
4 4 3 4 4
5
5 5 4 3 2
3
1 1 2
5
5 4 3 5 5
 1
3
10 1 5

1
 1
-1
2
2
3
1
 1

import java.util.*;

public class tooEZ {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        
        for(int i=0; i<t; i++){
            int n = sc.nextInt();
            String sup = "";
            String hai = "";
            int max=0;
            int tmp;
            for(int k=0; k<n;k++){
                tmp = sc.nextInt();
                sup = sup + String.valueOf(tmp);
                if(tmp>max)
                    max = tmp;
            }
            for(int j=0; j<sup.length();j++){
                if(sup.charAt(j)-'0'<max)
                    hai += "0";
                else
                    hai += "1";
            }
            if(!hai.contains("01") && !hai.contains("10"))
                System.out.println(-1);
            else{
                if(hai.contains("10"))
                    System.out.println(hai.indexOf("10"));
                else
                    System.out.println(hai.indexOf("01")+1);
            }
        }
    }
}