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 collections
  # import random
  # import math
  # import itertools
  # import math
  # mport math
  import bisect
  # from collections import defaultdict
  # import itertools
  # from sys import stdin, stdout
  # import math
  # import math
  # import bisect
  # import bisect
  # import collections
  # import itertools
  # import math
  import collections
  import itertools
  import sys
  
  # import operator
  # from decimal import Decimal
  
  # sys.setrecursionlimit(10**6)
  
  
  
  
  
  p2D = lambda x: print(*x, sep="\n")
  
  
  def II(): return int(sys.stdin.buffer.readline())
  
  
  def MI(): return map(int, sys.stdin.buffer.readline().split())
  
  
  def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
  
  
  def LLI(rows_number): return [LI() for _ in range(rows_number)]
  
  
  def BI(): return sys.stdin.buffer.readline().rstrip()
  
  
  def SI(): return sys.stdin.buffer.readline().rstrip().decode()
  
  
  def li(): return [int(i) for i in input().split()]
  
  
  def lli(rows): return [li() for _ in range(rows)]
  
  
  def si(): return input()
  
  
  def ii(): return int(input())
  
  
  def ins(): return input().split()
  
  
  # mod = 10**9+7
  # fval = [1]
  # for i in range(1,200001):
  #     x = (fval[-1]*i)%mod
  #     fval.append(x)
  #
  # ifac = [1]*(200001)
  # ifac[200000] = pow(fval[200000], -1, mod)
  # for i in range(200000-1, 1, -1): ifac[i] = ifac[i+1]*(i+1)%mod
  # _________________ For taking Input from the Text Files __________________
  # import os.path
  #
  # if (os.path.exists('input.txt')):
  #     sys.stdin = open("input.txt", "r")
  #     sys.stdout = open("output.txt", "w")
  #     sys.stderr = open("error.txt", "w")
  
  def drank(d, processing, da, rank):
      tmp = 10 ** 9
      if len(d[da]) == 1:
          return 1
      for di in d[da]:
          if processing[di - 1] == 0:
              processing[di - 1] = 1
              tmp = min(tmp, drank(d, processing, di, rank))
              processing[di - 1] = 0
      rank[da - 1] = tmp + 1
      return tmp + 1
  
  
  
  def binary_search(n, a):
      l = len(a)
      low = 0
      high = l-1
      while high>=low:
          mid = (high+low)//2
          if a[mid] == n:
              return mid
          elif a[mid]>n:
              high = mid-1
          else:
              low = mid+1
      return -1
  
  is_prime = [True]*(10**6+1)
  def primeseive(n):
      is_prime[0] = is_prime[1] = False
      i = 2
      while i*i<=n:
          if is_prime[i] == True:
              for j in range(i*i,n+1,i):
                  is_prime[j] = False
          i+=1
  
  
  def solve():
      n = ii()
      a = li()
      a = a[::-1]
      ans = 0
      m = a[0]
      for i in range(1,n):
          if a[i]>m:
              ans+=1
              m = a[i]
      return ans
  
  
  
  def main():
      #primeseive(10**6)
      #print(is_prime)
      for _ in range(II()):
      #print(solve())
          sys.stdout.write(str(solve()) + "\n")
      # print(solve())
  
      #     z += str(ans) + '\n'
      # print(len(ans), ' '.join(map(str, ans)), sep='\n')
      # stdout.write(z)
  
  
  # for interactive problems
  # print("? {} {}".format(l,m), flush=True)
  # or print this after each print statement
  # sys.stdout.flush()
  
  
  if __name__ == "__main__":
      main()