A hexagonal piece is a hexagon whose sides are labeled with distinct integers values between 1 and 6. A Hexagonal Puzzle is a set of seven hexagonal pieces, e.g., A Hexagonal Puzzle is solvable if and only if its pieces can be translated and rotated, without reflecting or flipping any of them, to form a honeycomb pattern where neighboring sides of any two pieces are labeled with the same integer values. The following figure depicts a honeycomb pattern witnessing the fact that the above hexagonal puzzle is solvable: Your task is to determine if a given Hexagonal Puzzle is solvable or not. Input The input contains several test cases, each one of them corresponding to the description of a Hexagonal Puzzle. A case comprises seven lines, each one containing a blank-separated permutation of the numbers 1, 2, . . . , 6 indicating the clockwise labeling of the sides of a hexagonal piece of the puzzle. Output For each case print one line with the word ‘YES’ if the given Hexagonal Puzzle is solvable, or the word ‘NO’ otherwise. Answers should be left aligned. Sample Input 123456 136524 142563 152364 162435 162453 165324 123456 123456
2/2 123456 123456 123456 123456 123456 Sample Output YES NO