SP18457 VFRIENDS - Very Friends

Description

_NOTICE_: The test cases for this problem are not as hard as intended. If you've solved this problem, and think your solution is up for it, try [VFRIEND2](../VFRIEND2)! You are creating a new soical network for dogs. Wow. The dogs don't have many possibilities for interacting with your website, but they can bark how many friends they want. E.g. if a dog wants to have much 8 friends it will bark 8 times, and if it doesn't want any friends, it'll just stay quiet. After spending a good year of your life collecting these barks, you are finally ready to assign a friend list for each dog. The only problem is: You are not sure whether it is actually possible. Thus before you proceed you would like to write a program, that given a list of **N** wishes **w $ _{i} $** , outputs **HAPPY** if it is possible to make a friend list for each dog **i** of length **w $ _{i} $** , or **SAD** if some dog will have to get more or fewer friends than it wished for. Notice: Being friends is considered an irreflexive, symetric relation. Update: If you manage to solve this problem much efficiently, have a look at VFRIEND2, which is a so harder version of this problem.

Input Format

The first line will contain a single integer **T** - the number of test cases to process. Each following lines will start with an integer **0 followed by an ordered list of **N** wishes **0 .****

Output Format

Write the answer - **HAPPY** or **SAD** - for each test case on a separate line.