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.io.*;
import java.util.*;
 
 
 public class Solution{
     public static MyScanner sc;
     public static PrintWriter out;
   public static void solve()
   {
       int t = sc.nextInt();
       while(t-- > 0){
           int n = sc.nextInt();
           int[]arr = new int[n];
           for(int i = 0 ; i < n ; i++)
            arr[i] = sc.nextInt();
            
            int j = 1;
            for(j = 1 ; j < n; j++){
                if(arr[j] != arr[j-1])
                    break;
            }
            
            if(j == n){
                out.println("-1");
            }
            else{
                Stack<Integer> st = new Stack<>();
                int finalIndex = 0;
                st.push(arr[0]);
                for(int i = 1 ; i < n; i++){
                    if(arr[i] < st.peek()){
                        int curr = st.pop();
                        st.push(curr+1);
                    }
                    else if(arr[i] > st.peek()){
                        int count = 0;
                        while(!st.isEmpty() && st.peek() < arr[i]){
                            count++;
                            st.pop();
                        }
                        st.push(arr[i]+count);
                        finalIndex = i;
                    }
                    else{
                        st.push(arr[i]);
                        finalIndex = i;
                    }
                }
                
                
                int current = st.pop();
                while(!st.isEmpty() && st.peek() < current){
                    st.pop();
                }
                if(st.isEmpty()){
                    out.println(finalIndex+1);
                }
                else{
                    out.println("-1");
                }
            }
       }
   }
   
   public static void main(String[] args) {
        sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));
      
      new Solution().solve();
      
      out.close();
   }

     

   
   
      
   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         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;
      }

   }
}