#P1168C. And Reachability
And Reachability
Description
Toad Pimple has an array of integers .
We say that is reachable from if and there exists an integer array such that , and for all integers such that .
Here denotes the bitwise AND operation.
You are given pairs of indices, check reachability for each of them.
The first line contains two integers and (, ) — the number of integers in the array and the number of queries you need to answer.
The second line contains space-separated integers () — the given array.
The next lines contain two integers each. The -th of them contains two space-separated integers and (). You need to check if is reachable from .
Output lines. In the -th of them print "Shi" if is reachable from , otherwise, print "Fou".
Input
The first line contains two integers and (, ) — the number of integers in the array and the number of queries you need to answer.
The second line contains space-separated integers () — the given array.
The next lines contain two integers each. The -th of them contains two space-separated integers and (). You need to check if is reachable from .
Output
Output lines. In the -th of them print "Shi" if is reachable from , otherwise, print "Fou".
Note
In the first example, . You can't reach it, because AND with it is always zero. , so is reachable from , and to go from to you can use .