#P1168E. Xor Permutations

    ID: 2491 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>constructive algorithmsmath*3100

Xor Permutations

No submission language available for this problem.

Description

Toad Mikhail has an array of 2k2^k integers a1,a2,,a2ka_1, a_2, \ldots, a_{2^k}.

Find two permutations pp and qq of integers 0,1,,2k10, 1, \ldots, 2^k-1, such that aia_i is equal to piqip_i \oplus q_i for all possible ii, or determine there are no such permutations. Here \oplus denotes the bitwise XOR operation.

The first line contains one integer kk (2k122 \leq k \leq 12), denoting that the size of the array is 2k2^k.

The next line contains 2k2^k space-separated integers a1,a2,,a2ka_1, a_2, \ldots, a_{2^k} (0ai<2k0 \leq a_i < 2^k) — the elements of the given array.

If the given array can't be represented as element-wise XOR of two permutations of integers 0,1,,2k10, 1, \ldots, 2^k-1, print "Fou".

Otherwise, print "Shi" in the first line.

The next two lines should contain the description of two suitable permutations. The first of these lines should contain 2k2^k space-separated distinct integers p1,p2,,p2kp_{1}, p_{2}, \ldots, p_{2^k}, and the second line should contain 2k2^k space-separated distinct integers q1,q2,,q2kq_{1}, q_{2}, \ldots, q_{2^k}.

All elements of pp and qq should be between 00 and 2k12^k - 1, inclusive; piqip_i \oplus q_i should be equal to aia_i for all ii such that 1i2k1 \leq i \leq 2^k. If there are several possible solutions, you can print any.

Input

The first line contains one integer kk (2k122 \leq k \leq 12), denoting that the size of the array is 2k2^k.

The next line contains 2k2^k space-separated integers a1,a2,,a2ka_1, a_2, \ldots, a_{2^k} (0ai<2k0 \leq a_i < 2^k) — the elements of the given array.

Output

If the given array can't be represented as element-wise XOR of two permutations of integers 0,1,,2k10, 1, \ldots, 2^k-1, print "Fou".

Otherwise, print "Shi" in the first line.

The next two lines should contain the description of two suitable permutations. The first of these lines should contain 2k2^k space-separated distinct integers p1,p2,,p2kp_{1}, p_{2}, \ldots, p_{2^k}, and the second line should contain 2k2^k space-separated distinct integers q1,q2,,q2kq_{1}, q_{2}, \ldots, q_{2^k}.

All elements of pp and qq should be between 00 and 2k12^k - 1, inclusive; piqip_i \oplus q_i should be equal to aia_i for all ii such that 1i2k1 \leq i \leq 2^k. If there are several possible solutions, you can print any.

Samples

Sample Input 1

2
0 1 2 3

Sample Output 1

Shi
2 0 1 3 
2 1 3 0

Sample Input 2

2
0 0 0 0

Sample Output 2

Shi
0 1 2 3 
0 1 2 3

Sample Input 3

2
0 1 2 2

Sample Output 3

Fou