In ECOOville there is a neighbourhood named ECOO in which there is a street named ECOO. There are a number of children who live on ECOO street and there are a number of pensioners who live on the street. There are children, each of whom belongs to one of friend groups. The children's locations on the street are such that the child lives in the house from the left.
ECOO street is a very busy but narrow single lane street accessible to bicycles and pedestrians only. Because of this, the municipality decided to make each segment of the street (between house and house ) a one-way segment of the street. This is done so that only one moving pedestrian or a bicycle can go through at a time.
However, they cannot decide on the flow of traffic on each segment. The ECOO Parents Association (EPA) wants their kids to have fun. Thus, they want the number of pairs of friends such that one friend can visit the other by taking the one-way roads () to be maximal.
On the other hand, the ECOO Elderly Association (EEA) does not like the noise that the children make when they are with their friends. Thus, they want to minimize . Eventually, they came to the compromise that both parties will be happy if .
Is it possible for the municipality to direct the flow of traffic such that ?
Constraints
Subtask 1 [5%]
Subtask 2 [10%]
Subtask 3 [5%]
Subtask 4 [20%]
Subtask 5 [60%]
No further constraints.
Input Specification
The first line of input contains integers , , and .
The next line contains integers , the friend group of the child.
Output Specification
If it is not possible to make , print not happy
on one line, otherwise, print happy
on one line.
Sample Input
4 1 6
1 1 1 1
Sample Output
happy
Explanation for Sample Output 1
If all the roads are directed in the same way, for all pairs of friends, one can visit the other.
Sample Input 2
4 1 5
1 1 1 1
Sample Output 2
not happy
Comments