#d1601. 并行排序

并行排序

Parallel Sort

Problem Description

You are given an integer nn and a permutation aa of length nn. Draw an edge between two positions ii and jj if i<ji < j and a[i]>a[j]a[i] > a[j]. Now you must color the nn vertices so that the two endpoints of every edge have different colors, using as few colors as possible. Output the minimum number of colors used.

Input Format

The first line contains an integer TT, the number of test cases.

For each test case, the first line contains an integer nn.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

One number: the minimum number of colors needed.

Sample Input

2
4
1 3 4 2
2
1 2

Sample Output

2
1

Constraints

For all data, 1≤∑n≤1061 \le \sum n \le 10^6.