#P1810A. Beautiful Sequence

Beautiful Sequence

No submission language available for this problem.

Description

A sequence of mm integers a1,a2,,ama_{1}, a_{2}, \ldots, a_{m} is good, if and only if there exists at least one ii (1im1 \le i \le m) such that ai=ia_{i} = i. For example, [3,2,3][3,2,3] is a good sequence, since a2=2a_{2} = 2, a3=3a_{3} = 3, while [3,1,1][3,1,1] is not a good sequence, since there is no ii such that ai=ia_{i} = i.

A sequence aa is beautiful, if and only if there exists at least one subsequence of aa satisfying that this subsequence is good. For example, [4,3,2][4,3,2] is a beautiful sequence, since its subsequence [4,2][4,2] is good, while [5,3,4][5,3,4] is not a beautiful sequence.

A sequence bb is a subsequence of a sequence aa if bb can be obtained from aa by the deletion of several (possibly, zero or all) elements.

Now you are given a sequence, check whether it is beautiful or not.

Each test contains multiple test cases. The first line contains a single integer tt (1t5001 \le t \le 500) — the number of test cases. Their description follows.

The first line of each test case contains an integer nn (1n1001 \le n \le 100) — the length of the given sequence.

The second line of each test case contains nn integers a1,a2,,ana_{1}, a_{2}, \ldots, a_{n} (1ai1091 \le a_{i} \le 10^9), representing the sequence.

For each test case, output "YES" or "NO"(without quotes) in one line, representing whether the given sequence is beautiful.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Input

Each test contains multiple test cases. The first line contains a single integer tt (1t5001 \le t \le 500) — the number of test cases. Their description follows.

The first line of each test case contains an integer nn (1n1001 \le n \le 100) — the length of the given sequence.

The second line of each test case contains nn integers a1,a2,,ana_{1}, a_{2}, \ldots, a_{n} (1ai1091 \le a_{i} \le 10^9), representing the sequence.

Output

For each test case, output "YES" or "NO"(without quotes) in one line, representing whether the given sequence is beautiful.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Sample Input 1

7
3
3 2 1
4
2 4 3 5
5
2 3 5 5 6
2
3 1
5
2 4 5 2 3
4
5 6 7 8
6
6 5 4 3 2 1

Sample Output 1

YES
YES
NO
YES
YES
NO
YES

Note

In the first test case, the good subsequence is b=[3,2]b=[3,2], where b2=2b_{2} = 2.

In the second test case, the good subsequence is b=[2,4,3]b=[2,4,3], where b3=3b_{3} = 3.

In the fourth test case, the good subsequence is b=[1]b=[1], where b1=1b_{1} = 1.

In the fifth test case, the good subsequence is b=[2,2]b=[2,2], where b2=2b_{2} = 2.