#K45232. Secret Santa Gift Distribution

    ID: 27708 Type: Default 1000ms 256MiB

Secret Santa Gift Distribution

Secret Santa Gift Distribution

In the Secret Santa Gift Distribution problem, you are given multiple test cases. In each test case, there are N participants. The task is to decide whether it is possible to arrange a Secret Santa gift exchange so that every participant gives a gift to someone else without giving one to themselves.

The decision is straightforward: a valid distribution is possible if and only if N > 1. If there is only one participant (i.e., N = 1), then it is impossible to avoid self-assignment, and the answer should be "NO". Otherwise, for any group of more than one participant, the answer is "YES".

Note: Although each test case provides a list of integers representing participant identifiers, this list is not used when determining the output.

The problem can also be expressed in mathematical terms as:

\( \text{Answer} = \begin{cases} \text{NO} & \text{if } N = 1, \\ \text{YES} & \text{if } N > 1. \end{cases} \)

inputFormat

The first line of input contains a single integer (T), the number of test cases. Each test case consists of two lines:

  1. The first line contains an integer (N) representing the number of participants.
  2. The second line contains (N) space-separated integers representing participant identifiers (which are irrelevant to the solution).

outputFormat

For each test case, output a single line containing "YES" if a valid Secret Santa gift distribution is possible, or "NO" otherwise. A valid distribution exists if and only if (N > 1).## sample

3
3
1 2 3
4
4 3 2 1
3
3 1 2
YES

YES YES

</p>