CF1399A.Remove Smallest

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Remove Smallest

You are given the array aa consisting of nn positive (greater than zero) integers.

In one move, you can choose two indices ii and jj (iji \ne j) such that the absolute difference between aia_i and aja_j is no more than one (aiaj1|a_i - a_j| \le 1) and remove the smallest of these two elements. If two elements are equal, you can remove any of them (but exactly one).

Your task is to find if it is possible to obtain the array consisting of only one element using several (possibly, zero) such moves or not.

You have to answer tt independent test cases.

Input

The first line of the input contains one integer tt (1t10001 \le t \le 1000) — the number of test cases. Then tt test cases follow.

The first line of the test case contains one integer nn (1n501 \le n \le 50) — the length of aa. The second line of the test case contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1001 \le a_i \le 100), where aia_i is the ii-th element of aa.

Output

For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.

Note

In the first test case of the example, we can perform the following sequence of moves:

  • choose i=1i=1 and j=3j=3 and remove aia_i (so aa becomes [2;2][2; 2]);
  • choose i=1i=1 and j=2j=2 and remove aja_j (so aa becomes [2][2]).

In the second test case of the example, we can choose any possible ii and jj any move and it doesn't matter which element we remove.

In the third test case of the example, there is no way to get rid of 22 and 44.

Samples

5
3
1 2 2
4
5 5 5 5
3
1 2 4
4
1 3 4 4
1
100
YES
YES
NO
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验