Little Ali’s Little Brother!

Little Ali has a cute little brother. Recently, their father has bought them a strange puzzle. The pieces of this puzzle has horizontal or vertical edges (See figure below). Some sample pieces of a puzzle Since Little Ali loves his brother too much, he decided to entertain him with a challenging task! He gave his brother the puzzle board and some pieces, not necessarily fitting in the board. Little Ali does not want to trouble his little brother, so he decided to select the pieces that can fit in the board without any rotation. Now, he needs your help to decide if a piece can be placed appropriately in the board or not. Input The input begins with a single integer T in a line representing the number of test cases. Then, T test cases follow. Each test case begins with the specification of a board, which is an N × M grid. In the first line of each test case, there are three integers N, M, S (0 < N,M ≤ 50, 0 < S ≤ 10) in a single line representing the number of rows and columns of the board and the number of pieces respectively. After that, N lines follow each containing exactly M characters where ‘’ denotes a cell of the board that a piece can occupy it and ‘.’ for the cells which the piece cannot occupy it. Afterwards, S blocks follow that each block contain specification of a piece. Specification of each block begins with two integers in a single line n, m (0 < n,m ≤ 50) representing the number of rows and columns of a rectangle box containing the piece (not necessarily minimum bounding box). Then, n lines follow ! each containing exactly m characters specifying a piece where ‘’ denotes a cell belonging to the piece and ‘.’ denotes a cell not belonging to the piece. There is a blank line after each test case. Output For each piece of a test case, you must print ‘Yes’ in the single line if this piece can be placed on the corresponding board and ‘No’ otherwise. Print a blank line after each test case. Sample Input 2 552 ....* ...**

2/2 ..*** ...** ....* 32 ** ** ** 16 ****** 331 *** . *** 32 ** .* ** Sample Output Yes No Yes