RCPC Simulare 2023 day 2 | J. Parallelogram

This was the problem page during the contest. Access the current page here.
Time limit: 1s Memory limit: 256MB Input: Output:

Bob has nn sticks. The ii-th stick has length aia_i. He needs to choose a tuple of 44 sticks (ii, jj, kk, pp) such that:

  • 1i<j<k<pn1 \leq i < j < k < p \leq n;
  • by moving and rotating the sticks any way you want (without breaking them) you can obtain a parallelogram with sides of lengths ai,aj,ak,apa_i, a_j, a_k, a_p.

Task

Bob is interested if there is such a tuple. He asks you to print YES if you can choose 4 sticks satisfying the above properties, and NO otherwise.

Input

The first line contains an integer tt (1t1041 \leq t \leq 10^4) the number of test cases. Then follows the description of each test case.

The first line of each test case contains a single integer nn (1n21051 \leq n \leq 2 \cdot 10^5) the number of sticks.

The second line of each test case contains nn integers a1,a2,ana_1, a_2, \dots a_n (1ain1 \leq a_i \leq n) - the length of the sticks.

It is guaranteed that the sum of the values of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, you have to print the answer to Bob's question.

Examples

stdin

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

stdout

YES
NO
YES

Log in or sign up to be able to send submissions!