Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS on his tree, starting from the root. BFS can be described by the following pseudocode:
    
    
    a = [] # the order in which vertices were processed  
    q = Queue()  
    q.put(1) # place the root at the end of the queue  
    while not q.empty():  
        k = q.pop() # retrieve the first vertex from the queue  
        a.append(k) # append k to the end of the sequence in which vertices were visited  
        for y in g[k]: # g[k] is the list of all children of vertex k, sorted in ascending order  
            q.put(y)  
    

Monocarp was fascinated by BFS so much that, in the end, he lost his tree. Fortunately, he still has a sequence of vertices, in which order vertices were visited by the BFS algorithm (the array a from the pseudocode). Monocarp knows that each vertex was visited exactly once (since they were put and taken from the queue exactly once). Also, he knows that all children of each vertex were viewed in ascending order.

Monocarp knows that there are many trees (in the general case) with the same visiting order a, so he doesn't hope to restore his tree. Monocarp is okay with any tree that has minimum height.

The height of a tree is the maximum depth of the tree's vertices, and the depth of a vertex is the number of edges in the path from the root to it. For example, the depth of vertex 1 is 0, since it's the root, and the depth of all root's children are 1.

Help Monocarp to find any tree with given visiting order a and minimum height.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first line of each test case contains a single integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of vertices in the tree.

The second line of each test case contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n; a_i ≠ a_j; a_1 = 1) — the order in which the vertices were visited by the BFS algorithm.

It's guaranteed that the total sum of n over test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case print the minimum possible height of a tree with the given visiting order a.

Example

Input


3
4
1 4 3 2
2
1 2
3
1 2 3


Output


3
1
1

Note

In the first test case, there is only one tree with the given visiting order: 

<image>

In the second test case, there is only one tree with the given visiting order as well: 

<image>

In the third test case, an optimal tree with the given visiting order is shown below: 

<image>
import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter pw;
    static Scanner sc;
    static long ceildiv(long x, long y) { return (x+y-1)/y; }
    static int mod(long x, int m) { return (int)((x%m+m)%m); }
    static void put(TreeMap<Long, Integer> map, long p){if(map.containsKey(p)) map.replace(p, map.get(p)+1); else map.put(p, 1); }
    static void rem(TreeMap<Long, Integer> map, long p){ if(map.get(p)==1) map.remove(p);else map.replace(p, map.get(p)-1); }
    static void printf(double x, int dig){ String s="%."+dig+"f"; pw.printf(s, x); }
    static int Int(boolean x){ return x?1:0; }
    static final int inf=(int)1e9, mod=inf+7;
    static final long infL=inf*1l*inf;
    static final double r2=Math.sqrt(2), eps=1e-9;
    static ArrayList<Integer>[] adj;
    static long[] arr, fact;
    public static long gcd(long x, long y) { return y==0? x: gcd(y, x%y); }
    public static void main(String[] args) throws IOException {
        sc=new Scanner(System.in);
        pw=new PrintWriter(System.out);
        int t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt(), arr[]=sc.nextArr(n);
            int par=arr[0]-1;
            Queue<Integer> q=new LinkedList<>();
            int[] h=new int[n];
            h[par]=0;
            q.add(arr[1]-1);
            h[arr[1]-1]=1;
            for(int i=2; i<n; i++){
                if(arr[i]<arr[i-1])
                    par=q.poll();
                h[arr[i]-1]=h[par]+1;
                q.add(arr[i]-1);
            }
            int max=1;
            for(int x: h)
                max=Math.max(max, x);
            pw.println(max);
        }
        pw.close();
    }
    static boolean equal(long[] a, long[] b){
        boolean ans=true;
        for(int i=0; i<a.length && ans; i++)
            ans&=a[i]==b[i];
        return ans;
    }
    static long[] multiply(long[][] arr, long[] vec){
        long[] ans=new long[vec.length];
        for(int i=0; i< vec.length; i++)
            ans[i]=multiply(arr[i], vec);
        return ans;
    }
    static long multiply(long[] a, long[] b){
        long ans=0;
        for(int i=0; i<a.length; i++)
            ans=(ans+a[i]*b[i])%mod;
        return ans;
    }
    static void in(long[][] arr, int n) throws IOException{
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++)
                arr[i][j]=sc.nextInt();
        }
    }
    static void printArr(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(long[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(double[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(Integer[] arr) {
        for (int i = 0; i < arr.length; i++)
            pw.print(arr[i] + " ");
        pw.println();
    }
    static void printArr(ArrayList<Integer> list) {
        for (int i = 0; i < list.size(); i++)
            pw.print(list.get(i)+1+" ");
        pw.println();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;
        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        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 int[] nextDigits() throws IOException{
            String s=nextLine();
            int[] arr=new int[s.length()];
            for(int i=0; i<arr.length; i++)
                arr[i]=s.charAt(i)-'0';
            return arr;
        }
        public int[] nextArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++)
                arr[i] = nextInt();
            return arr;
        }
        public Integer[] nextsort(int n) throws IOException{
            Integer[] arr=new Integer[n];
            for(int i=0; i<n; i++)
                arr[i]=nextInt();
            return arr;
        }
        public Pair nextPair() throws IOException{
            return new Pair(nextInt(), nextInt());
        }
        public Pair[] nextPairArr(int n) throws IOException{
            Pair[] arr=new Pair[n];
            for(int i=0; i<n; i++)
                arr[i]=nextPair();
            return arr;
        }
        public boolean ready() throws IOException {
            return br.ready();
        }
    }
    static class Pair implements Comparable<Pair>{
        int x;
        int y;
        public Pair(int x, int y) {
            this.x=x;
            this.y=y;
        }
        public boolean contains(int a){
            return x==a || y==a;
        }
        public int hashCode() {
            return (this.x*1000+this.y);
        }
        public int compareTo(Pair p){
            return y-p.y;
        }
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (this.getClass() != obj.getClass()) {
                return false;
            }
            Pair p = (Pair) obj;
            return this.x==p.x && this.y==p.y;
        }
        public Pair clone(){
            return new Pair(x, y);
        }
        public String toString(){
            return this.x+" "+this.y;
        }
        public void add(Pair p){
            x+=p.x;
            y+=p.y;
        }
    }
    static class LP implements Comparable<LP>{
        long x, y;
        public LP(long a, long b){
            x=a;
            y=b;
        }
        public void add(LP p){
            x+=p.x;
            y+=p.y;
        }
        public boolean equals(LP p){
            return p.x==x && y==p.y;
        }
        public String toString(){
            return this.x+" "+this.y;
        }
        public int compareTo(LP p){
            if(x>p.x)
                return 1;
            if(x<p.x)
                return -1;
            return Long.compare(y, p.y);
        }
    }
    static class Triple implements Comparable<Triple>{
        int x, y, z;
        public Triple(int a, int b, int c){
            x=a;
            y=b;
            z=c;
        }
        public int compareTo(Triple t){
            if(this.y!=t.y)
                return y-t.y;
            return x-t.x;
        }
        public String toString(){
            return x+" "+y+" "+z;
        }
    }
    static class Fenwick{
        long[] tree, arr;
        public Fenwick(long[] a){
            arr=a.clone();
            build();
        }
        public void build(){
            tree=new long[arr.length+1];
            for(int i=0; i<arr.length; i++)
                build(i+1);
        }
        public void build(int i){
            long val=arr[i-1];
            while(i<tree.length){
                tree[i]+=val;
                i+=i&(-i);
            }
        }
        public long query(int i, int j){
            return query(j)-query(i-1);
        }
        public long query(int i){
            if(i==0)
                return 0;
            return tree[i]+query(i-(i&-i));
        }
    }
}