Sang-geun starts every morning by solving the Sudoku puzzle printed in the newspaper. One day, while solving one, he noticed something strange: the puzzle he was working on was yesterday's puzzle rotated by 90 degrees. He felt deeply betrayed. Of course, when he begins a puzzle he cannot tell whether it is yesterday's, but as he fills in the numbers he eventually realizes it.
Furious, Sang-geun spent every night drinking, and decided he could no longer put up with the newspaper's tyranny. So he wants to check whether today's puzzle was made from yesterday's puzzle through a few simple operations.
A Sudoku board consists of $9 \times 9$ cells. Moreover, every $3 \times 3$ block of cells is grouped together into one of nine regions. Initially only some cells are filled with numbers between 1 and 9, and all the remaining cells are empty. The goal of the puzzle is to fill the empty cells with numbers from 1 to 9 so that each of the numbers 1 through 9 appears exactly once in every row, every column, and every region. A valid Sudoku puzzle always has exactly one way to fill in the empty cells.
The allowed simple operations are as follows.
All of the operations above are applied to a Sudoku's solution (a completed board), and any Sudoku that was solvable before a transformation is still solvable after it.
The first line contains the number of test cases $N$ ($0 \le N \le 50$).
For each test case, the first 9 lines are yesterday's puzzle's answer, and the next 9 lines are today's puzzle. Empty cells are given as 0.
Consecutive test cases are separated by a single blank line. Yesterday's puzzle is always a valid Sudoku, and today's puzzle also has exactly one answer.
For each test case, print Yes if today's puzzle is a transformation of yesterday's puzzle, and No otherwise.