Gregor lives by the saying “One for all and all for one”, so you can(’t) imagine what he has done when he received a sequence of numbers for his birthday! He created a new operation on the sequence: delete all elements of value 𝑥 and join the remaining parts. For example, if the sequence contains the integers then applying the operation for yields
Gregor would like you to apply this operation a number of times so that the resulting sequence has certain properties. First, the resulting sequence must be increasing, and second, among all such increasing sequences, it must have maximum length. We consider a sequence to be increasing if . Similarly we consider it to be decreasing if .
Task
More formally, you are given a sequence of integers. Your task is to find the maximum length of a possible increasing sequence obtained by deleting all elements of some chosen values.
Help Gregor in his journey of discovering the answer!
Input data
Each input file contains multiple test cases. The first line of the input contains the number , the number of test cases. The description of the test cases follows. Each test case contains two lines. The first line of a test case contain , the length of the input sequence. The second line of a test case contains the input sequence.
Output data
You should output lines. Line should contain the answer for test case .
Restrictions
- Let denote the sum of the values of for all the test cases within a particular input file. .
- Let be the biggest value in the sequence.
# | Points | Restrictions |
---|---|---|
1 | 6 | The input sequence is increasing. |
2 | 6 | The input sequence is deincreasing. |
3 | 7 | |
4 | 19 | No two elements in an input sequence are equal. |
5 | 23 | |
6 | 39 | No further restrictions. |
Examples
stdin
3
2
1 1
4
1 2 1 2
10
1 2 1 2 1 3 1 2 4 3
stdout
2
2
5
Notes
In the first test case, Gregor can keep all the values, as the sequence is already increasing.
In the second test case, Gregor needs to delete at leas one of the values to get an increasing sequnce, so the answer is .
In the third test case, it can be proven that by deleting values and , Gregor will achieve a maximum length increasing sequence.