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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "khokharnikunj8", 1 << 29);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            DMinimalHeightTree solver = new DMinimalHeightTree();
            int testCount = Integer.parseInt(in.next());
            for (int i = 1; i <= testCount; i++)
                solver.solve(i, in, out);
            out.close();
        }
    }

    static class DMinimalHeightTree {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) ar[i] = in.readInt();
            BSTIntegerMulti bst = new BSTIntegerMulti();
            bst.insert(0, 1);
            for (int i = 1; i < n; ) {
                int j = i + 1;
                while (j < n && ar[j] > ar[j - 1]) j++;
                int count = j - i;
                int minimum = bst.get(0);
                bst.remove(minimum, 1);
                bst.insert(minimum + 1, count);
                i = j;
            }
            out.println(bst.get(bst.getSize() - 1));
        }

    }

    static class BSTIntegerMulti {
        final int DEFAULT_CAPACITY = 15;
        int[] value;
        int[] leftNode;
        int[] rightNode;
        int[] leftCount;
        int[] rightCount;
        int[] nodeCount;
        int[] height;
        int[] stack = new int[64];
        int cap;
        int nextFree;
        int root;
        int size;
        int stackPointer;

        public BSTIntegerMulti(int cap) {
            this.cap = 0;
            nextFree = 1;
            size = 0;
            resize(cap + 1);
        }

        public BSTIntegerMulti() {
            this.cap = 0;
            nextFree = 1;
            size = 0;
            resize(DEFAULT_CAPACITY);
        }

        private void resize(int newCap) {
            int[] newValue = new int[newCap];
            int[] newLeftNode = new int[newCap];
            int[] newRightNode = new int[newCap];
            int[] newNodeCount = new int[newCap];
            int[] newLeftCount = new int[newCap];
            int[] newRightCount = new int[newCap];
            int[] newHeight = new int[newCap];

            if (cap != 0) {
                System.arraycopy(value, 0, newValue, 0, cap);
                System.arraycopy(leftNode, 0, newLeftNode, 0, cap);
                System.arraycopy(rightNode, 0, newRightNode, 0, cap);
                System.arraycopy(nodeCount, 0, newNodeCount, 0, cap);
                System.arraycopy(leftCount, 0, newLeftCount, 0, cap);
                System.arraycopy(rightCount, 0, newRightCount, 0, cap);
                System.arraycopy(height, 0, newHeight, 0, cap);
            }
            value = newValue;
            leftNode = newLeftNode;
            rightNode = newRightNode;
            nodeCount = newNodeCount;
            leftCount = newLeftCount;
            rightCount = newRightCount;
            height = newHeight;
            cap = newCap;
        }

        private int newNode(int val, int count) {
            if (nextFree == cap) resize(cap << 1);
            value[nextFree] = val;
            leftNode[nextFree] = 0;
            rightNode[nextFree] = 0;
            leftCount[nextFree] = 0;
            rightCount[nextFree] = 0;
            nodeCount[nextFree] = count;
            height[nextFree] = 1;
            return nextFree++;
        }

        public void insert(int data, int count) {
            size += count;
            if (root == 0) {
                root = newNode(data, count);
                return;
            }
            int root = this.root;
            int stackPointer = 0;
            int recentChildren = -1;
            while (true) {
                if (value[root] == data) {
                    nodeCount[root] += count;
                    return;
                } else if (value[root] > data) {
                    stack[stackPointer++] = root;
                    leftCount[root] += count;
                    if (leftNode[root] == 0) {
                        recentChildren = leftNode[root] = newNode(data, count);
                        break;
                    }
                    root = leftNode[root];
                } else {
                    stack[stackPointer++] = root;
                    rightCount[root] += count;
                    if (rightNode[root] == 0) {
                        recentChildren = rightNode[root] = newNode(data, count);
                        break;
                    }
                    root = rightNode[root];
                }
            }

            while (stackPointer > 0) {
                int node = stack[--stackPointer];
                if (value[node] > data) leftNode[node] = recentChildren;
                else rightNode[node] = recentChildren;
                updateHeight(node);
                int diff = getDiff(node);
                if (diff > 1) {
                    if (data < value[leftNode[node]]) {
                        recentChildren = rightRotate(node);
                    } else {
                        leftNode[node] = leftRotate(leftNode[node]);
                        recentChildren = rightRotate(node);
                    }
                } else if (diff < -1) {
                    if (data > value[rightNode[node]]) {
                        recentChildren = leftRotate(node);
                    } else {
                        rightNode[node] = rightRotate(rightNode[node]);
                        recentChildren = leftRotate(node);
                    }
                } else {
                    recentChildren = node;
                }
            }
            this.root = recentChildren;
        }

        public void remove(int data, int count) {
            stackPointer = 0;
            root = remove(root, data, count);
        }

        private int remove(int curRoot, int data, int count) {
            if (curRoot == 0) return curRoot;
            int st = stackPointer;
            int recentChildren = -1;
            int root = curRoot;
            int pivot = -1;
            while (true) {
                if (value[root] == data) {
                    if (nodeCount[root] > count) {
                        size -= count;
                        nodeCount[root] -= count;
                        return curRoot;
                    } else if (nodeCount[root] == count) {
                        size -= count;
                        nodeCount[root] -= count;
                        if (leftNode[root] == 0 && rightNode[root] == 0) recentChildren = 0;
                        else if (leftNode[root] == 0) recentChildren = rightNode[root];
                        else if (rightNode[root] == 0) recentChildren = leftNode[root];
                        else {
                            pivot = root;
                            stack[stackPointer++] = root;
                            int min = minValue(rightNode[root]);
                            value[root] = value[min];
                            nodeCount[root] = nodeCount[min];
                            rightCount[root] -= nodeCount[min];
                            recentChildren = rightNode[root] = remove(rightNode[root], value[min], nodeCount[min]);
                            size += nodeCount[root];
                        }
                        break;
                    } else throw new RuntimeException("Removing more than present");
                } else if (value[root] > data) {
                    stack[stackPointer++] = root;
                    leftCount[root] -= count;
                    if (leftNode[root] == 0) break;
                    root = leftNode[root];
                } else {
                    stack[stackPointer++] = root;
                    rightCount[root] -= count;
                    if (rightNode[root] == 0) break;
                    root = rightNode[root];
                }
            }
            if (recentChildren == -1) {
                while (stackPointer > 0) {
                    int node = stack[--stackPointer];
                    if (value[node] > data) leftCount[node] += count;
                    else rightCount[node] -= count;
                }
                return curRoot;
            }
            while (stackPointer - st > 0) {
                int node = stack[--stackPointer];
                if (node != pivot)
                    if (value[node] > data) leftNode[node] = recentChildren;
                    else rightNode[node] = recentChildren;
                updateHeight(node);
                int diff = getDiff(node);
                if (diff > 1) {
                    if (getDiff(leftNode[node]) >= 0) {
                        recentChildren = rightRotate(node);
                    } else {
                        leftNode[node] = leftRotate(leftNode[node]);
                        recentChildren = rightRotate(node);
                    }
                } else if (diff < -1) {
                    if (getDiff(rightNode[node]) <= 0) {
                        recentChildren = leftRotate(node);
                    } else {
                        rightNode[node] = rightRotate(rightNode[node]);
                        recentChildren = leftRotate(node);
                    }
                } else {
                    recentChildren = node;
                }
            }
            return recentChildren;
        }

        private int minValue(int id) {
            while (leftNode[id] != 0) id = leftNode[id];
            return id;
        }

        private void updateHeight(int id) {
            height[id] = Math.max(height[leftNode[id]], height[rightNode[id]]) + 1;
        }

        private void updateCount(int id) {
            leftCount[id] = leftCount[leftNode[id]] + rightCount[leftNode[id]] + nodeCount[leftNode[id]];
            rightCount[id] = leftCount[rightNode[id]] + rightCount[rightNode[id]] + nodeCount[rightNode[id]];
        }

        private int rightRotate(int id) {
            int left = leftNode[id];
            int leftRight = rightNode[left];
            rightNode[left] = id;
            leftNode[id] = leftRight;
            updateHeight(id);
            updateCount(id);
            updateHeight(left);
            updateCount(left);
            return left;
        }

        private int leftRotate(int id) {
            int right = rightNode[id];
            int rightLeft = leftNode[right];
            leftNode[right] = id;
            rightNode[id] = rightLeft;
            updateHeight(id);
            updateCount(id);
            updateHeight(right);
            updateCount(right);
            return right;
        }

        private int getDiff(int id) {
            return height[leftNode[id]] - height[rightNode[id]];
        }

        public int get(int index) {
            int root = this.root;
            assert (root < size);
            while (root != 0) {
                if (leftNode[root] == 0) {
                    if (index - nodeCount[root] < 0)
                        return value[root];
                    else {
                        index -= nodeCount[root];
                        root = rightNode[root];
                    }
                } else {
                    if (index - leftCount[root] < 0) root = leftNode[root];
                    else if (index - leftCount[root] - nodeCount[root] < 0) return value[root];
                    else {
                        index -= (leftCount[root] + nodeCount[root]);
                        root = rightNode[root];
                    }
                }
            }
            throw new RuntimeException("BST out of index");
        }

        public int getSize() {
            return size;
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private final Writer os;
        private final StringBuilder cache = new StringBuilder(5 << 20);

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class FastInput {
        private final InputStream is;
        private final StringBuilder defaultStringBuf = new StringBuilder(1 << 13);
        private final byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public String next() {
            return readString();
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public String readString(StringBuilder builder) {
            skipBlank();

            while (next > 32) {
                builder.append((char) next);
                next = read();
            }

            return builder.toString();
        }

        public String readString() {
            defaultStringBuf.setLength(0);
            return readString(defaultStringBuf);
        }

    }
}

