NC212625. LinkGameofPrimeFactors
描述
输入描述
There are multiple test cases. The first line of the input contains an integer T (1 ≤ T ≤ 20), indicating the number of test cases.
For each test case, the first line contains two integers n and m (1 ≤ n, m ≤ 10).
In the next n lines, each line contains m integers, j-th number in the i-th line means the original number (0 ≤ ≤ 200) at the position in the matrix.
输出描述
For each case, output "Yes"(without quotes) if and only if all of the non-empty grids that can be removed altogether. Otherwise, output "No"(without quotes) instead.
示例1
输入:
3 8 8 43 101 4 87 8 7 50 19 3 77 10 8 31 11 11 13 52 26 7 15 33 27 4 85 18 65 4 15 21 43 89 9 71 89 49 26 9 21 13 5 19 9 17 15 5 5 21 60 17 3 8 52 64 11 10 71 29 5 31 88 2 34 52 101 8 8 101 43 1 22 30 1 45 15 66 55 12 121 12 15 55 11 26 64 19 4 26 11 38 96 39 29 66 101 46 43 27 9 27 48 87 32 81 9 22 18 36 5 9 10 44 13 49 103 13 8 78 72 52 6 23 6 9 13 117 110 65 54 103 27 3 3 1 2 3 1 3 2 1 0 0
输出:
Yes No No
说明:
For the second sample, it'll be no solution. Because the number 49 can not be removed.