Cube again

Time Limit: 2000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5864
64-bit integer IO format: %I64d      Java class name: Main

Description

Given the state of two 2*2 magic cube, you need to find out whether they are isomorphism or not.

Isomorphism means that one cube can be the same with the other one after rotating the whole cube, specular reflection and swapping all the same color on the cube with another color.

Input

There are no more than 10000 test case end with EOF. Each case contains 16 lines. First 8 lines describe the state of the first cube, and the next 8 line describe the other one. A state is given as the format in the picture above. Number from 1 to 6 means the colors. All states are ensured legal.

Output

If the two cube are isomorphism, print "yes", otherwise print "no", without quotes.

Sample Input

11
11
223344
223344
55
55
66
66
22
22
113355
113355
44
44
66
66
11
11
223344
223344
55
55
66
66
22
22
113344
113344
55
55
66
66
11
11
223344
223344
55
55
66
66
13
13
223544
223544
56
56
61
61

Sample Output

yes
yes
no

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .