문제
A stamp painting is a black and white painting on an canvas, where certain cells are inked while others are blank. It can be described by an array of characters (). The th entry of the th column of the array is equal to * if the canvas contains ink at that square and . otherwise.
Bessie has a stamp painting that she would like to create, so Farmer John has lent her a single () stamp to do this and an empty canvas. Bessie can repeatedly rotate the stamp clockwise by and stamp anywhere on the grid as long as the stamp is entirely inside the grid. Formally, to stamp, Bessie chooses integers such that and ; for each such that , canvas cell is painted black if the stamp has ink at . Bessie can rotate the stamp at any time between stampings. Once a canvas cell is painted black, it remains black.
Farmer John is wondering whether it's possible for Bessie to create her desired stamp painting with his stamp. For each of () test cases, help Farmer John answer this question.
입력
The first line of input contains , the number of test cases.
Each test case starts with an integer followed by lines, each containing a string of *s and .s, representing Bessie's desired stamp painting. The next line contains and is followed by lines, each containing a string of *s and .s, representing Farmer John's stamp.
Consecutive test cases are separated by newlines.
출력
For each test case, output "YES" or "NO" on separate lines.
예제 입력 1
4
2
**
*.
1
*
3
.**
.**
***
2
.*
**
3
...
.*.
...
3
.*.
...
...
3
**.
.**
..*
2
.*
*.
예제 출력 1
YES
YES
NO
YES
코드를 제출하려면 로그인이 필요합니다.
로그인