Cube
题号:NC237554
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Lucy has one cube folded from paper .

For example ,the paper below can be folded into the cube on the right .

The opposite side of 1 is 6 , opposite side of 3 is 2 , and opposite side of 4 is 5 .

Now Clare has another cube folded from paper too .

Please help them determine whether their cubes are isomorphic .

Two cubes are isomorphic when :

For each number , the number on the opposite side of the two cubes are same .

输入描述:

There are two parts to describe the cubes . 

Each part has exactly 3 lines , and each line has 4 integers , separated by white space .

Number indicates that this position is part of the cube , and the number on it is i , 0 indicates it's not part of the cube .

It is guaranteed that for each cube , each number from 1 to 6 will appear exactly once , and the paper can form a cube .

输出描述:

If the two cubes are isomorphic , print "YES'' , otherwise print "NO'' .
示例1

输入

复制
0 0 0 4
3 6 1 2
5 0 0 0
0 0 4 0
6 3 5 0
0 0 2 1

输出

复制
NO
示例2

输入

复制
3 0 0 0
1 5 6 2
0 0 4 0
5 0 0 0
3 1 4 6
0 0 0 2

输出

复制
YES

说明

For each cube , the non-zero position in the input must meet one of the following conditions .

备注:

For each cube , the non-zero position in the input must meet one of the following conditions .