404978: GYM101726 A Popularity on Facebook

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Popularity on Facebooktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Nowadays everyone is connected, has a Facebook page, posts photos to Instagram and videos to Youtube, and so on. Even GPS systems now are based on social networks, making everything more fun (and harder to understand, but that's another problem).

Being popular on Facebook is almost a need. A person with less than 700, 800 friends may be considered almost a pariah in this new reality.

Maybe that's why some people tend to exaggerate when telling the number of friends they have. Consider a community with N people and, for each one of them, consider we know the number of friends that person says he or she has on this community. Your task is to determine if in fact it is possible that everyone is telling the truth. Remember someone cannot be his or her own friend, and two people cannot be friends more than once.

Input

On the first line T, the number of test cases.

The first line of each test case has an integer N. The second line has N space-separated integers a1, ..., aN. The i-th person claims to have ai friends on the community.

Limits

  • 1 ≤ N ≤ 105
  • 0 ≤ ai ≤ 105
  • The sum of N over all test cases does not exceed 5·105
Output

For each case, print on a single line Y if it is possible that no one is lying, or N otherwise.

ExampleInput
2
3
1 1 1
3
2 2 2
Output
N
Y

Source/Category

加入题单

算法标签: