404978: GYM101726 A Popularity on Facebook
Description
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.
InputOn 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
For each case, print on a single line Y if it is possible that no one is lying, or N otherwise.
ExampleInput2Output
3
1 1 1
3
2 2 2
N
Y