Erast Kopi is a well known designer of Sudoku puzzles. His puzzle collections sold so well that imitations and plagiarisms followed. Before he files a lawsuit, he wants to gather more evidence.
A Sudoku puzzle is a 9×9 table divided into 3×3 subtables of 3×3 cells each. A cell may hold one digit from 1 to 9. The goal of the puzzle is to fill the empty cells with digits so that every row, every column and each of the nine 3×3 subtables contains every digit from 1 to 9 exactly once.
Kopi keeps a database of Sudoku puzzles and wants to know whether it holds similar puzzles. Puzzle P is similar to puzzle Q if some sequence of the operations below turns P into Q.
Help Kopi find the similar puzzles in his database.
The first line contains one integer n, the number of puzzles in the database (1≤n≤20).
The rest of the input describes the puzzles P1,P2,…,Pn. Each puzzle takes nine lines of nine characters. Each character is either a digit from 1 to 9 or a dot . that marks an empty cell. One empty line separates consecutive puzzles.
The input has no spaces. The puzzles are not guaranteed to be solvable, so a row or a column may repeat a digit.
For every pair (i,j) with 1≤i<j≤n, print Yes if puzzle Pi is similar to puzzle Pj and No otherwise, one answer per line.
The pairs come in the order (1,2),(1,3),…,(1,n),(2,3),(2,4),…,(n−1,n). That is, first compare P1 against P2,P3,…,Pn in this order, then compare P2 against P3,P4,…,Pn, and so on.