Maurits Cornelis Escher (commonly known as M.C. Escher) was a famous Dutch graphic artist. He is known for his mathematically inspired pictures representing impossible constructions, explorations of infinity, architecture, and tessellations. A tessellation (or tiling) of the plane is a pattern of plane figures that fills the plane with no overlaps and no gaps. Anthony Joseph (known by his friends as A.J.) is a student of the School of Computer Science doing research on a particular kind of tessellations. Essentially, the figures that are going to be replicated across the plane are comprised of a certain number of squares with a fixed size. A.J. wants to know if a given figure tessellates on a given board (a rectangle). You have to observe that when a figure protrudes the board by one of its edges, it appears at the opposite side (i.e., the board is circular). The following image gives an example of a figure that tessellates on a particular board and another example of a figure that does not tessellate: This figure does not tessellate on a 4x4 board. This figure tessellates on an 8x8 board. Note that a figure can tessellate on a board of certain dimensions, but could not tessellate on a board of other dimensions. Now, A.J. is asking you to write a program that helps him to check if a figure tessellates or not on a given board. Input The input consists of a first line with a number indicating the number of test cases. Then the test cases are separated by a new line. Each test case consists of three parts. First, two numbers (≤ 8) indicating the height and width, respectively, of the smallest rectangle that completely surrounds the figure. Second, there are as many lines as the height of the figure, each one with as many characters as the width of the figure. Each character can be one of these two symbols: ‘#’ and ‘.’.
2/2 ‘#’ indicates that this position is covered by the figure. ‘.’ indicates that this position is not covered by the figure. The last line of each test case contains two numbers (≤ 8) that indicate the height and the width of the board. Output For each input case, you must print a line containing the word ‘YES’ in case the given figure tessellates for the given board or containing the word ‘NO’ otherwise. Sample Input 2 33 .## ### ### 88 22 #. ## 44 Sample Output YES NO