description: You are given an array a of length n.
  
  Let's define the eversion operation. Let x = a_n. Then array a is partitioned into two parts: left and right. The left part contains the elements of a that are not greater than x (≤ x). The right part contains the elements of a that are strictly greater than x (> x). The order of elements in each part is kept the same as before the operation, i. e. the partition is stable. Then the array is replaced with the concatenation of the left and the right parts.
  
  For example, if the array a is [2, 4, 1, 5, 3], the eversion goes like this: [2, 4, 1, 5, 3] → [2, 1, 3], [4, 5] → [2, 1, 3, 4, 5].
  
  We start with the array a and perform eversions on this array. We can prove that after several eversions the array a stops changing. Output the minimum number k such that the array stops changing after k eversions.
  
  Input
  
  Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 100). Description of the test cases follows.
  
  The first line contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^5).
  
  The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9).
  
  It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case print a single integer k — the number of eversions after which the array stops changing.
  
  Example
  
  Input
  
  
  3
  5
  2 4 1 5 3
  5
  5 3 2 4 1
  4
  1 1 1 1
  
  
  Output
  
  
  1
  2
  0
  
  Note
  
  Consider the fist example.
  
    * The first eversion: a = [1, 4, 2, 5, 3], x = 3. [2, 4, 1, 5, 3] → [2, 1, 3], [4, 5] → [2, 1, 3, 4, 5]. 
    * The second and following eversions: a = [2, 1, 3, 4, 5], x = 5. [2, 1, 3, 4, 5] → [2, 1, 3, 4, 5], [] → [2, 1, 3, 4, 5]. This eversion does not change the array, so the answer is 1. 
  
  
  
  Consider the second example. 
  
    * The first eversion: a = [5, 3, 2, 4, 1], x = 1. [5, 3, 2, 4, 1] → [1], [5, 3, 2, 4] → [1, 5, 3, 2, 4]. 
    * The second eversion: a = [1, 5, 3, 2, 4], x = 4. [1, 5, 3, 2, 4] → [1, 3, 2, 4], [5] → [1, 3, 2, 4, 5]. 
    * The third and following eversions: a = [1, 3, 2, 4, 5], x = 5. [1, 3, 2, 4, 5] → [1, 3, 2, 4, 5], [] → [1, 3, 2, 4, 5]. This eversion does not change the array, so the answer is 2. 
solution:     import java.io.BufferedReader;
      import java.io.BufferedWriter;
      import java.math.*;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.io.OutputStream;
      import java.io.OutputStreamWriter;
      import java.io.PrintWriter;
      import java.io.Writer;
      import java.math.BigInteger;
      import java.util.*;
      import java.util.Map.Entry;
  
      
  //-------------------------------///////////////****/////////******//////////
  //------------------------------------///**********//*****//********//*****//
  //-----------------------------------///**********//*****//********//*****//
  //----------------------------------///**********//*****//********//*****//
  //---------------------------------///**********//*****//********//*****//
  //--------------------------------///**********//*****//********//*****//
  //--------------------------///**///**********//*****//********//*****//
  //---------------------------/////***********/////////*******//////////
  
      
      public class CodeForces
      {
      	final static String no = "NO";
      	final static String yes = "YES";
      	static long count = 0;
      	
      	static public OutputWriter w = new OutputWriter(System.out);
      	static public FastScanner sc = new FastScanner();
      	
  
      	static HashMap<Integer,Integer> map = new HashMap<>();
      	
      	static Scanner fc = new Scanner(System.in);
  
  //*******************************************Be SANSA**********************************************************
  //************************************Don't stick to single approach********************************************	
  //*****************************************You are a slow learner But you learn*********************************
  //***************************************Don't fall in rating trap***********************************************
  //**********************************Pain in temporary, regret remains forever************************************
      	
      	
          public static void main(String[] args) {
          	int test =sc.nextInt();
          	in:
          	while(test-->0) {
          		
          		int n = sc.nextInt();
          		int[]arr = sc.readArray(n);
          		int max = Integer.MIN_VALUE;
          		for(int i=0;i<n;i++) {
          			max = Math.max(max,arr[i]);
          		}
          		int tmax = 0;
          		Stack<Integer> stk = new Stack<>();
          		for(int i=n-1;i>=0;i--) {
          			if(max==arr[i])
          			{
          				break;
          			}
          			if( stk.isEmpty() ||(!stk.isEmpty() && stk.peek()<arr[i])) {
          				stk.push(arr[i]);
          			}
          		}
          		w.writer.println(stk.size());
          	}
          	w.writer.flush();
          	
          	
          	
          	
          }
          
          static int sod(long  n) {
          	int res = 0;
          	while(n!=0) {
          		res+=n%10;
          		n = n/10;
          	}
  			return res;
  		}
  		static class Pair {
              int visits, index;
              Pair(int visits, int index) {
                  this.visits = visits;
                  this.index = index;
              }
          }
          static public boolean checkBit(int n,int i){
              if((n>>i & 1)==1){
                  return true;
              }else{
                  return false;
              }
          }
          public static long pow(long a,long p)
          {
              long res=1;
              while(p>0)
              {
                  if(p%2==1)
                  {
                      p--;
                      res*=a;
                      res%=(long)1e9+7;
                  }
                  else
                  {
                      a*=a;
                      a%=(long)1e9+7;
                      p/=2;
                  }
              }
              return res;
          }
          static int gcd(int a, int b){
              if (a == 0)
                  return b;
              return gcd(b % a, a);
          }
          static long gcd(long a, long b){
              if (a == 0)
                  return b;
              return gcd(b % a, a);
          }
           
          // method to return LCM of two numbers
          static long lcm(long a, long b)
          {
              return (a / gcd(a, b)) * b;
          }
          static long getPairsCount(long[] arr, long sum)
          {
              Map<Long, Long> hm = new HashMap<>();
              int n = arr.length;
              long count = 0;
              for(int i =0;i<n;i++) {
              	if(hm.containsKey(sum - arr[i])) {
              		count+=hm.get(sum-arr[i]);
              	}
              	if(hm.get(arr[i])!=null) {
              		hm.put(arr[i], hm.get(arr[i])+1);
              	}
              	else {
              		hm.put(arr[i], 1l);
              	}
              }
              return count;
          }
          static long sumLong(int[]arr) {
          	long sum =0;
          	for(int x:arr) {
          		sum+=x;
          	}
          	return sum;
          }
          static boolean isEqualList(ArrayList<Integer> arr,ArrayList<Integer> temp){
              for(int i =0;i<arr.size();i++){
                  if(arr.get(i)!=temp.get(i)){
                      return true;
                  }
              }
              return false;
          }
      	static void sort(int[] arr) {
              Random rand = new Random();
              int n = arr.length;
              for (int i = 0; i < n; i++) {
                  int idx = rand.nextInt(n);
                  if (idx == i) continue;
                  arr[i] ^= arr[idx];
                  arr[idx] ^= arr[i];
                  arr[i] ^= arr[idx];
              }
              Arrays.sort(arr);
          }
       
          static void sort(long[] arr) {
              Random rand = new Random();
              int n = arr.length;
              for (int i = 0; i < n; i++) {
                  int idx = rand.nextInt(n);
                  if (idx == i) continue;
                  arr[i] ^= arr[idx];
                  arr[idx] ^= arr[i];
                  arr[i] ^= arr[idx];
              }
              Arrays.sort(arr);
          }
       
          static void sortDec(int[] arr) {
              Random rand = new Random();
              int n = arr.length;
              for (int i = 0; i < n; i++) {
                  int idx = rand.nextInt(n);
                  if (idx == i) continue;
                  arr[i] ^= arr[idx];
                  arr[idx] ^= arr[i];
                  arr[i] ^= arr[idx];
              }
              Arrays.sort(arr);
              int l = 0;
              int r = n - 1;
              while (l < r) {
                  arr[l] ^= arr[r];
                  arr[r] ^= arr[l];
                  arr[l] ^= arr[r];
                  l++;
                  r--;
              }
          }
       
          static void sortDec(long[] arr) {
              Random rand = new Random();
              int n = arr.length;
              for (int i = 0; i < n; i++) {
                  int idx = rand.nextInt(n);
                  if (idx == i) continue;
                  arr[i] ^= arr[idx];
                  arr[idx] ^= arr[i];
                  arr[i] ^= arr[idx];
              }
              Arrays.sort(arr);
              int l = 0;
              int r = n - 1;
              while (l < r) {
                  arr[l] ^= arr[r];
                  arr[r] ^= arr[l];
                  arr[l] ^= arr[r];
                  l++;
                  r--;
              }
          }
      	
      	
      	static int[] countInversions(int[]arr,int low,int high){
      		if(low==high) {
      			int base[] = new int[1];
      			base[0] = arr[low];
      			return base;
      		}
      		int mid = low+(high-low)/2;
      		int left[] = countInversions(arr,low,mid);
      		int right[] = countInversions(arr,mid+1,high);
      		int[]merged = merge(left,right);
      		return merged;
      	}
      	
      	
      	static int[] merge(int first[], int[]next) {
      		
      		int i = 0;
      		int j = 0;
      		int k = 0;
      		int[]merged = new int[first.length+next.length];
      		while(j<first.length && k<next.length) {
      			if(first[j]<=next[k]) {
      				merged[i++] = first[j++];
      			}else {
      				count += first.length -j;
      				merged[i++] = next[k++];
      				
      			}
      		}
      		while(j<first.length) {
      			merged[i++] = first[j++];
      		}
      		while(k<next.length) {
      			merged[i++] = next[k++];
      		}
      		return merged;
      	}
      	static class FastScanner {
      		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      		StringTokenizer st=new StringTokenizer("");
      		String next() {
      			while (!st.hasMoreTokens())
      				try {
      					st=new StringTokenizer(br.readLine());
      				} catch (IOException e) {
      					e.printStackTrace();
      				}
      			return st.nextToken();
      		}
      		
      		int nextInt() {
      			return Integer.parseInt(next());
      		}
      		int [] readArray(int n) {
      			int[] a=new int[n];
      			for (int i=0; i<n; i++) a[i]=nextInt();
      			return a;
      		}
      		long nextLong() {
      			return Long.parseLong(next());
      		}
      		long [] longArray(int n) {
      			long[] a=new long[n];
      			for(int i=0 ; i<n ; i++) a[i]=nextLong();
      			return a;
      		}
      		double nextDouble() {
      			return Double.parseDouble(next());
      		}
      	}
          static public class OutputWriter {
              private  final PrintWriter writer;
       
              public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
              }
       
              public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
              }
       
              public void print(Object... objects) {
                  for (int i = 0; i < objects.length; i++) {
                      if (i != 0)
                          writer.print(' ');
                      writer.print(objects[i]);
                  }
              }
       
              public void printLine(Object... objects) {
                  print(objects);
                  writer.println();
              }
       
              public void close() {
                  writer.close();
              }
          }
       
       
      }