eolymp
bolt
Try our new interface for solving problems
Problems

Fate to hate

Fate to hate

Ira's birthday was approaching. On the night from \textbf{27}th to the \textbf{28}th, Sasha could not sleep for a long time. Mathematically logical nonsense was discretely coming to the head. An ordinary daisy divination has become a cruel game of numbers and bit operations. The dream was about an infinite field of indistinguishable daisies. Each daisy had \textbf{N} petals, and each of them had a number on it. From time to time, the fear that Ira can change the number of her ICQ forced to wake up in a cold sweat. And every time a new number came to head, it certainly had to be obtained from the petals by applying to the numbers written on them operations, \textbf{AND} and \textbf{OR}. If the number could be obtained, it was a good sign, otherwise the same dream became infused with horror of hate and evil. All daisies are the same, and they can be endlessly to picked in order to use the right petals. So to get one number, you can pick several daisies and pick a non-empty subset of their petals. In his dreams, Sasha is able to fully control the order of operations. \InputFile The first line contains the number \textbf{N} --- the number of petals on a daisy (\textbf{1} ≤ \textbf{N} ≤ \textbf{10^5}). The next line lists the integers on the petals \textbf{a_i} (\textbf{0} ≤ \textbf{a_i} ≤ \textbf{10^9}). Next line contains the number \textbf{Q} --- the number of ICQ-numbers which must be obtained (\textbf{1} ≤ \textbf{Q} ≤ \textbf{10^5}). Each of the following \textbf{Q} lines contains one ICQ number \textbf{b_i} (\textbf{0} ≤ \textbf{b_i} ≤ \textbf{10^9}). \OutputFile For each ICQ number, output one line containing "\textbf{Fate}", if this number can be obtained from the numbers on the petals by applying bitwise \textbf{AND} and \textbf{OR}, operations to them, or "\textbf{Hate}", if it is impossible.
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
3
1 4 5
6
1
2
3
4
5
6
Output example #1
Fate
Hate
Hate
Fate
Fate
Hate