You are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.

A pixel is the smallest element of an image, and in this problem it is a square of size 1×1.

Also, the given images are binary images, and the color of each pixel is either white or black.  
In the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.

The image A is given as N strings A_1,...,A_N.

The j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).

Similarly, the template image B is given as M strings B_1,...,B_M.

The j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).  
Determine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.  

-----Constraints-----
 - 1≦M≦N≦50 
 - A_i is a string of length N consisting of # and ..
 - B_i is a string of length M consisting of # and ..

-----Input-----
The input is given from Standard Input in the following format:
N M
A_1
A_2
:  
A_N
B_1
B_2
:  
B_M

-----Output-----
Print Yes if the template image B is contained in the image A. Print No otherwise.

-----Sample Input-----
3 2
#.#
.#.
#.#
#.
.#

-----Sample Output-----
Yes

The template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.
[{"code": "n, m = map(int, input().split())\na = [\"\" for _ in range(n)]\nb = [\"\" for _ in range(m)]\nfor i in range(n):\n    a[i] = str(input())\nfor i in range(m):\n    b[i] = str(input())\ndef check(ini_x, ini_y):\n    nonlocal n, m, a, b\n    for x in range(m):\n        for y in range(m):\n            if a[ini_x + x][ini_y + y] != b[x][y]:\n                return False\n    return True\nfor i in range(n - m + 1):\n    for j in range(n - m + 1):\n        if check(i, j):\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.36, "memory": 14356.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na, b = [], []\nfor i in range(n):\n  a.append(input())\nfor i in range(m):\n  b.append(input())\n  \nans = False\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    flag = True\n    for k in range(m):\n      if a[i+k][j:j+m] != b[k]:\n        flag = False\n    if flag:\n      ans = True\n\nif ans:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.16, "memory": 14364.0, "status": "done"}, {"code": "def main():\n    n,m = list(map(int,input().split()))\n    a,b = [], []\n    for i in range(n):\n        a.append(input())\n    for i in range(m):\n        b.append(input())\n    for i in range(n-m+1):\n        for j in range(n-m+1):\n            a_ = []\n            for k in range(m):\n                a_.append(a[i+k][j:j+m])\n            if a_==b:\n                print('Yes')\n                return\n    print('No')\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.16, "memory": 14412.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [''] * N\nB = [''] * M\nfor i in range(N):\n    A[i] = input()\nfor i in range(M):\n    B[i] = input()\n\nmatch_cnt = 0\nfor i in range(N - M + 1):\n    for j in range(N - M + 1):\n        flag = True\n        for y in range(M):\n            if A[y + i][j:j + M] != B[y]:\n                flag = False\n        if flag:\n            match_cnt += 1\n\nif match_cnt > 0:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.17, "memory": 14188.0, "status": "done"}, {"code": "import math\nN, M = list(map(int, input().split()))\nA = [list(input()) for _ in range(N)]\nB = [list(input()) for _ in range(M)]\n\nfor i in range(0, math.ceil(N/M)):\n    for j in range(0, math.ceil(N/M)):\n        # \u7573\u307f\u8fbc\u307f\n        flag = True\n        for l in range(0, M):\n            for m in range(0, M):\n                if A[l+i][m+j] != B[l][m]:\n                    flag = False\n                    break\n        if flag == True:\n            print(\"Yes\")\n            return\nprint(\"No\")\n", "passed": true, "time": 0.15, "memory": 14408.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nA = list(input() for _ in range(N))\nB = list(input() for _ in range(M))\nans = \"No\"\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        if list(k[j:j+M] for k in A[i:i+M]) == B:\n            ans = \"Yes\"\nprint(ans)", "passed": true, "time": 0.17, "memory": 14396.0, "status": "done"}, {"code": "\n\ndef main():\n    n, m = list(map(int, input().split()))\n    a = ['' for i in range(n)]\n    b = ['' for i in range(m)]\n    for i in range(n):\n        a[i] = input()\n    for i in range(m):\n        b[i] = input()\n    for i1 in range(n - m + 1):\n        for i2 in range(n - m + 1):\n            fl = True\n            for j in range(m):\n                for k in range(m):\n                    if a[i1 + j][i2 + k] != b[j][k]:\n                        fl = False\n            if fl:\n                print(\"Yes\")\n                return\n    print(\"No\")\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 1.77, "memory": 14124.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        if b[0][0] == a[i][j]:\n            cnt = 0\n            for x in range(m):\n                flag = True\n                if flag == False:\n                    break\n                for y in range(m):\n                    if b[x][y] == a[i+x][j+y]:\n                        cnt += 1\n                        pass\n                    else:\n                        flag = False\n                        break\n                    if cnt == m**2:\n                        print(\"Yes\")\n                        return\nprint(\"No\")", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "import sys\nn,m = map(int,input().split())\nla = [input() for _ in range(n)]\nlb = [input() for _ in range(m)]\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        cnt = 0\n        for k in range(m):\n            for l in range(m):\n                if la[i+k][j+l] == lb[k][l]:\n                    cnt += 1\n        if cnt == m**2:\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.22, "memory": 14192.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na_lst = [str(input()) for _ in range(n)]\nb_lst = [str(input()) for _ in range(m)]\n\nflag = False\nfor i in range(n - m + 1):\n    for j in range(n - m + 1):\n\n        count = 0\n        if a_lst[i][j] == b_lst[0][0]:\n            for k in range(m):\n                for l in range(m):\n                    if a_lst[i + k][j + l] == b_lst[k][l]:\n                        count += 1\n\n            if count == m ** 2:\n                flag = True\n\nif flag:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.18, "memory": 14160.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\nr=n-m+1\nprint('Yes' if any([all([a[x//r+y//m][x%r+y%m]==b[y//m][y%m] for y in range(m**2)]) for x in range(r**2)]) else 'No')", "passed": true, "time": 0.26, "memory": 14340.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nR = list(range(N-M+1))\n\nfor i in R:\n    for j in R:\n        for k in range(M):\n            if A[j+k][i:i+M] != B[k]:\n                break\n        else:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.35, "memory": 14372.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nfor y in range(N - M + 1):\n    for x in range(N - M + 1):\n        matched = True\n        for yy in range(y, y + M):\n            for xx in range(x, x + M):\n                if A[yy][xx] != B[yy - y][xx - x]:\n                    matched = False\n                if not matched:\n                    break\n            if not matched:\n                break\n        if matched:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.28, "memory": 14148.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nA = [input() for i in range(n)]\nB = [input() for i in range(m)]\n \nflag = False\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        flag = True\n        for k in range(m):\n            if B[k] != A[i+k][j:j+m]:\n                flag = False\n        if flag:\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.15, "memory": 14276.0, "status": "done"}, {"code": "n,m = list(map(int,input().split()))\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nflag = False\nfor i in range(n-m+1):\n\n    for s in range(n-m+1):\n        if b[0]==a[i][s:s+m]:\n            index = s\n            cnt = 1\n            for j in range(1,m):\n                if not a[i+j][index:index+m]==b[j]:\n                    break\n                cnt+=1\n            if cnt==m:\n                flag = True\n                break\n\n\nprint((\"Yes\" if flag else \"No\"))\n", "passed": true, "time": 0.15, "memory": 14316.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nA=[]\nB=[]\nfor i in range(n):\n    A.append(input())\nfor i in range(m):\n    B.append(input())\ncnt=0\nflag = False\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        ans = 'Yes'\n        for k in range(m):\n            for l in range(m):\n                if A[i+k][j+l]!=B[k][l]:\n                    ans = 'No'\n        else:\n            if ans == 'Yes':\n                print(ans)\n                return\nprint(ans)", "passed": true, "time": 0.41, "memory": 14152.0, "status": "done"}, {"code": "import sys\nN, M = list(map(int, input().split()))\nA = []\nB = []\nfor _ in range(N):\n    A.append(input())\nfor _ in range(M):\n    B.append(input())\n\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        for k in range(M):\n            #print(A[i+k][j:j+M])\n            #print(B[k])\n            if A[i+k][j:j+M] != B[k]:\n                break\n        else:\n            print(\"Yes\")\n            return\nprint(\"No\")\n\n", "passed": true, "time": 0.14, "memory": 14428.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nA = [list(input()) for i in range(n)]\nB = [list(input()) for i in range(m)]\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    flag = True\n    for k in range(m):\n      if A[k+j][i:i+m] != B[k][:]:\n        flag = False\n        break\n    if flag:\n      print(\"Yes\")\n      return\nelse:\n  print(\"No\")", "passed": true, "time": 0.23, "memory": 14336.0, "status": "done"}, {"code": "n,m = [int(x) for x in input().split()]\na = []\nfor i in range(n):\n  a.append(list(input()))\nb = []\nfor i in range(m):\n  b.append(list(input()))\n\nres = \"No\"\n\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    flag = True\n    for k in range(m):\n      for l in range(m):\n        if a[k+i][l+j] != b[k][l]:\n          flag = False\n    if flag:\n      res = \"Yes\"\n\nprint(res)", "passed": true, "time": 0.35, "memory": 14160.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\nfor i in range(0,n-m+1):\n    for j in range(0,n-m+1):\n        p=[a[x][i:i+m] for x in range(j,j+m)]\n        ok=0\n        for h in range(m):\n            x,y=p[h],b[h]\n            for k in range(m):\n                if x[k]!=y[k]:\n                    ok+=1\n        if ok==0:\n            print('Yes')\n            return\nprint('No')", "passed": true, "time": 0.18, "memory": 14392.0, "status": "done"}, {"code": "import sys, math\nfrom itertools import combinations as c, product as p\nfrom collections import deque\nsys.setrecursionlimit(10**9)\n\n\ndef si(): return input()\ndef ii(): return int(input())\ndef fi(): return float(input())\ndef lstr(): return input().split()\ndef lint(): return list(map(int, input().split()))\ndef lint_dec(): return list(map(lambda x:int(x) - 1, input().split()))\ndef lnstr(n): return [input() for _ in range(n)]\ndef lnint(n): return [int(input()) for _ in range(n)]\ndef lint_list(n): return [lint() for _ in range(n)]\n\n\n\n############################################################\nN, M = lint()\nA = lnstr(N)\nB = lnstr(M)\nFLG = False\n\nfor i in range(N - M + 1):\n    for k in range(N - M + 1):\n        if [A[j + k][i:i + M] for j in range(M)] == B:\n            FLG = True\n            break\n    if FLG:\n        break\nprint('Yes' if FLG else 'No')", "passed": true, "time": 0.16, "memory": 14292.0, "status": "done"}, {"code": "n,m = map(int, input().split(\" \"))\na = [list(input()) for i in range(n)]\nb = [list(input()) for i in range(m)]\nch = m**2\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    if a[i][j] == b[0][0]:\n      count = 0\n      for k in range(m):\n        for l in range(m):\n          #print(i+k, j+l)\n          if a[i+k][j+l] == b[k][l]:\n            count += 1\n      if count == ch:\n        print(\"Yes\")\n        break\n  else:\n    continue\n  break\nelse:\n  print(\"No\")", "passed": true, "time": 0.3, "memory": 14208.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = []\nB = []\nfor i in range(N):\n    A.append(input())\nfor i in range(M):\n    B.append(input())\n\nfor i in range(N-M+1):\n    if B[0] in A[i]:\n        k = A[i].index(B[0])\n        points = 1\n        for j in range(1,M):\n            if B[j] == A[i+j][k:k+M]:\n                points += 1\n        if points == M:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "def f():\n    n, m = map(int, input().split())\n    a = [list(input()) for i in range(n)]\n    b = [list(input()) for j in range(m)]\n    for p in range(n - m + 1):\n        for q in range(n - m + 1):\n            cnt = 0\n            for x in range(m):\n                for y in range(m):\n                    if a[x+p][y+q] == b[x][y]:\n                        cnt += 1\n                        if cnt == m*m:\n                            return \"Yes\"\n                    else:\n                        break\n    return \"No\"\nprint(f())", "passed": true, "time": 0.15, "memory": 14132.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\n# input = stdin.readline\n\ndef solve(n,m,original,temp):\n  def judge(sy,sx):\n    for i in range(m):\n      for j in range(m):\n        if original[sy+i][sx+j] != temp[i][j]:\n          return False\n    return True\n  \n\n  sy = 0\n  while sy + m - 1 < n:\n    sx = 0\n    while sx + m - 1 < n:\n      if judge(sy,sx):\n        return True\n      sx += 1\n    sy += 1\n\n  return False\n\ndef main():\n  N,M = list(map(int,input().split()))\n  a = [input() for _ in range(N)]\n  b = [input() for _ in range(M)]\n  print((\"Yes\" if solve(N,M,a,b) else \"No\"))\n  return\n\ndef __starting_point():\n  main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\ndef main():\n    n, m = list(map(int, input().split()))\n    A = [input() for i in range(n)]\n    B = [input() for i in range(m)]\n    for i in range(n):\n        C = []\n        p = A[i].find(B[0])\n        if p != -1:\n            for j in range(m):\n                if i + j < n and p + len(B[0]) <= n:\n                    C.append(A[i + j][p:p + len(B[0])])\n            if C == B:\n                break\n\n    print(('Yes' if C == B else 'No'))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\nfor i in range(N - M + 1):\n  pos = -1\n  for j in range(A[i].count(B[0])):\n    pos = A[i].find(B[0], pos + 1)\n    for k in range(1, M):\n      if A[i + k].find(B[k], pos) != pos:\n        break\n    else:\n      print('Yes')\n      break\n  else:\n    continue\n  break\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nA = [input() for _ in range(n)]\nB = [input() for _ in range(m)]\nfor x, a in enumerate(A):\n    if x > n - m + 1:\n        break\n    for i in range(n - m + 1):\n        if a[i: i + m] == B[0]:\n            for j in range(m):\n                if A[x + j][i: i + m] != B[j]:\n                    break\n            else:\n                print(\"Yes\")\n                return\nprint(\"No\")\n", "passed": true, "time": 0.23, "memory": 14168.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = []\nb = []\nans = 0\nfor i in range(n):\n    a.append(list(input()))\nfor i in range(m):\n    b.append(list(input()))\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        cnt = 0\n        for s in range(m):\n            for t in range(m):\n                if b[s][t] == a[s+i][t+j]:\n                    cnt += 1\n        if cnt == m*m:\n            ans = 1\nif ans == 0:\n    print(\"No\")\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.2, "memory": 14144.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nA=list(list(input()) for _ in range(N))\nB=list(list(input()) for _ in range(M))\nflag=False\nfor i in range(0,N-M+1):\n    for j in range(0,N-M+1):\n        sub=True\n        for x in range(0,M):\n            for y in range(0,M):\n                if A[i+x][j+y]!=B[x][y]:\n                    sub=False\n        flag=flag or sub\nif flag:\n    print(\"Yes\")\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.19, "memory": 14264.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nAls = []\nBls = []\nans = 'No'\nif Bls == Als:\n    ans = 'Yes'\nfor i in range(N):\n    Als.append(input())\nfor i in range(M):\n    Bls.append(input())\nfor i in range(N-M):\n    for j in range(0,N-M):\n        for k in range(M):\n            if Bls[k] == Als[i+k][j:M+j]:\n                ans = 'Yes'\n            else:\n                ans = 'No'\n                break\n        if ans == 'Yes':\n            break\n    if ans == 'Yes':\n        break\nprint(ans)", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return list(map(int,input().split()))\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float(\"inf\")\nal = \"abcdefghijklmnopqrstuvwxyz\"\nAL = al.upper()\n\nn,m = I()\na = []\nb = []\n\nfor _ in range(n):\n    a += [list(input())]\nfor _ in range(m):\n    b += [list(input())]\n\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        if [k[j:m+j] for k in a[i:m+i]] == b:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.25, "memory": 14252.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\nimport string\n\ndef main():\n    N,M = i_map()\n    a = [s_input() for _ in range(N)]\n    b = [s_input() for _ in range(M)]\n\n    for i in range(N-M+1):\n        for j in range(N-M+1):\n            flg = True\n\n            for x in range(M):\n                for y in range(M):\n                    if b[x][y] != a[i+x][j+y]:\n                        flg = False\n                        break\n                if flg == False:\n                    break\n            if flg == True:\n                print(\"Yes\")\n                return\n    print(\"No\")\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.37, "memory": 14392.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nA = list(input() for _ in range(N))\nB = list(input() for _ in range(M))\nans = \"No\"\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        if [k[j:j+M] for k in A[i:i+M]] == B:\n            ans = \"Yes\"\n            \"\"\"\n        for k in A[i:i + M]:\n            if k[j:j + M]  == B:\n                ans = \"Yes\"\n        \"\"\"\nprint(ans)", "passed": true, "time": 0.64, "memory": 14156.0, "status": "done"}, {"code": "import sys\nN,M=map(int,input().split())\nA=[]\nfor i in range(N):\n  a=input()\n  A.append(a)\nB=[]\nfor j in range(M):\n  b=input()\n  B.append(b)\nfor k in range(N-M+1):\n  for l in range(N-M+1):\n    z=0\n    for m in range(M):\n      try:\n        if B[m]==A[k+m][l:l+M]:\n          z+=1\n      except:\n        sys.stderr.write(f\"{k,l,m}\")\n        pass\n    if z==M:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.26, "memory": 14292.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nA=[input() for _ in range(N)]\nB=[input() for _ in range(M)]\n\nans=\"No\"\n\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        flag = True\n        for k in range(M):\n            for l in range(M):\n                if A[i+k][j+l]!=B[k][l]:\n                    flag = False\n                    break\n                    \n        if flag:\n            ans=\"Yes\"\n            break\n\nprint(ans)", "passed": true, "time": 0.17, "memory": 14248.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        ans = True\n        for k in range(m):\n            if b[k] != a[i+k][j:j+m]:\n                ans = False\n        if ans:\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.81, "memory": 14264.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nA = [list(input()) for _ in range(N)]\nB = [list(input()) for _ in range(M)]\n\ncheck = False\n\nfor i in range(N-M+1):\n  for j in range(N-M+1):\n    if A[i][j:j+M] == B[0]:\n      flag = True\n      for k in range(1,M):\n        if A[i+k][j:j+M] != B[k]:\n          flag = False\n      if flag:\n        check = True\n\nprint(\"Yes\" if check else \"No\")", "passed": true, "time": 0.42, "memory": 14280.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\n\neq = False\nfind = False\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    for p in range(m):\n      for q in range(m):\n        if a[p+i][q+j] == b[p][q]:\n          eq = True\n        else:\n          eq = False\n          break\n      if not eq:\n        break\n    if eq:\n      find = True\n      break\n  if find:\n    break\nif find:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.2, "memory": 14184.0, "status": "done"}, {"code": "n,m=map(int,input().split())\n\nalist=[input() for _ in range(n)]\nblist=[input() for _ in range(m)]\n\ndef match(i,j):\n    for di in range(m):\n        for dj in range(m):\n            if alist[i+di][j+dj]!=blist[di][dj]:\n                return False \n    return True\n\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        if match(i,j):\n            print(\"Yes\")\n            return\n\nprint(\"No\")", "passed": true, "time": 0.18, "memory": 14208.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[list(input()) for i in range(n)]\nb=[list(input()) for i in range(m)]\nexist=False\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    match=True\n    for k in range(m):\n      for l in range(m):\n        if a[i+k][j+l]!=b[k][l]:\n          match=False\n    if match:\n      exist=True\nprint(\"Yes\" if exist else \"No\")", "passed": true, "time": 0.34, "memory": 14196.0, "status": "done"}, {"code": "import sys\nstdin=sys.stdin\n\nip=lambda: int(sp())\nfp=lambda: float(sp())\nlp=lambda:list(map(int,stdin.readline().split()))\nsp=lambda:stdin.readline().rstrip()\nyp=lambda:print('Yes')\nnp=lambda:print('No')\n\nn,m=lp()\nans=[]\nfor _ in range(n):\n  s=list(sp())\n  ans.append(s)\n\nnext=[]\nfor _ in range(m):\n  p=list(sp())\n  next.append(p)\n  \nok=0\ncount=0\nfor x in range(n-m+1):\n  for y in range(n-m+1):\n    ch=0\n    for e in range(m):\n      for f in range(m):\n        if ans[x+e][y+f]==next[e][f]:\n          ch+=1\n        if ch==m*m:\n          ok+=1\n  \nif ok==0:\n  print('No')\nelse:\n  print('Yes')\n        \n  ", "passed": true, "time": 0.22, "memory": 14396.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nA=[[] for i in range(N)]\nB=[[] for i in range(M)]\nfor i in range(N):\n  L=list(input())\n  A[i]=L\nfor i in range(M):\n  L=list(input())\n  B[i]=L\nfor i in range(N-M+1):\n  for j in range(N-M+1):\n    ans=0\n    for k in range(M):\n      for s in range(M):\n        #i,j\u3092\u59cb\u70b9\u3068\u3057\u305f\n        if B[k][s]!=A[i+k][j+s]:\n          ans=-1\n        if k==M-1 and s==M-1:\n          if ans==0:\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.31, "memory": 14348.0, "status": "done"}, {"code": "import sys\n\n\nN, M = [int(x) for x in input().split()]\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nfor i in range(N - M + 1):\n    for j in range(N - M + 1):\n        found = True\n        for _i in range(M):\n            for _j in range(M):\n                if A[i + _i][j + _j] != B[_i][_j]:\n                    found = False\n                    break\n            if not found:\n                break\n        if found:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nA=[input() for i in range(N)]\nB=''.join([input() for i in range(M)])\nf=0\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        if ''.join([A[l][j:j+M] for l in range(i,i+M)])==B:\n            f=1\nprint(['No','Yes'][f])", "passed": true, "time": 0.31, "memory": 14328.0, "status": "done"}, {"code": "N,M = [int(a) for a in input().split()]\nA = []\nB = []\nfor i in range(N):\n  A.append(input())\nfor i in range(M):\n  B.append(input())  \n\nwa = len(A[0])\nwb = len(B[0])\n  \nmatched = False\nfor i1 in range(N - M + 1):\n  for j1 in range(wa - wb +1):\n    cnt = 0\n    for i2 in range(M):\n      #print(B[i2],\" vs \", A[i1+i2][j1:j1+wb])\n      if B[i2] == A[i1+i2][j1:j1+wb]:\n        cnt += 1\n    if cnt == M:\n      matched = True\n      break\n          \n\nif matched:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.75, "memory": 14244.0, "status": "done"}, {"code": "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n    N, M = LI()\n    A = [SS() for _ in range(N)]\n    B = [SS() for _ in range(M)]\n\n    is_ok = False\n    for i, j in itertools.product(list(range(N - M + 1)), repeat=2):\n        tmp = True\n        for k in range(M):\n            if B[k] != A[i+k][j:j+M]:\n                tmp = False\n                break\n        if tmp:\n            is_ok = True\n            break\n\n    if is_ok:\n        print('Yes')\n    else:\n        print('No')\n\ndef __starting_point():\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14412.0, "status": "done"}, {"code": "from typing import List\n\n\ndef answer(n: int, m: int, a: List[str], b: List[str]) -> str:\n    for i in range(n - m + 1):\n        for j in range(n - m + 1):\n            if a[i][j:j + m] == b[0]:\n                matched_lines = 1\n                for k in range(1, m):\n                    if a[i + k][j:j + m] == b[k]:\n                        matched_lines += 1\n                    else:\n                        break\n                if matched_lines == m:\n                    return 'Yes'\n\n    return 'No'\n\n\ndef main():\n    n, m = map(int, input().split())\n    a = [input() for _ in range(n)]\n    b = [input() for _ in range(m)]\n    print(answer(n, m, a, b))\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.25, "memory": 15184.0, "status": "done"}, {"code": "# B - Template Matching\ndef main():\n    n, m = map(int, input().split())\n\n    a_l = [input() for i in range(n)]\n    b_l = [input() for i in range(m)]\n\n    for i in range(n-m+1):\n        for j in range(n-m+1):\n            ans = 'Yes'\n            for k in range(m):\n                for l in range(m):\n                    if a_l[i+k][j+l] != b_l[k][l]:\n                        ans = 'No'\n            else:\n                if ans == 'Yes':\n                    print(ans)\n                    return\n    print(ans)\n\n  \n        \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.32, "memory": 14172.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\na = [list(input()) for _ in range(n)]\nb = [list(input()) for _ in range(m)]\nflag = True\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        flag = True\n        for k in range(m):\n            for l in range(m):\n                if b[k][l] != a[i+k][j+l]:\n                    flag = False\n                    break\n        if flag:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.16, "memory": 14184.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\n\nfor i in range(N - M + 1):  # tate\n    for j in range(N - M + 1):  # yoko\n        ans = 1\n        for k in range(M):\n            if B[k] != A[i + k][j:j+M]:\n                ans = 0\n        if ans == 1:\n            print('Yes')\n            return\nprint('No')\n", "passed": true, "time": 0.15, "memory": 14272.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = [input() for i in range(n)]\nb = [input() for j in range(m)]\nfor i in range(n):\n  for j in range(n-m+1):\n    tf = 0\n    if a[i][j:j+m]==b[0] and i+m<=n:\n      tf = 1\n      for k in range(i+1,i+m):\n        if a[k][j:j+m]!=b[k-i]:\n          tf = 0\n    if tf:\n      print('Yes')\n      return\nelse:\n  print('No')", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "lst = input().split()\nN = int(lst[0])\nM = int(lst[1])\n\nA = []\nB = []\n\nfor i in range(N):\n   A.append(input())\n\nfor i in range(M):\n   B.append(input())\n\nif A == B:\n   print('Yes')\n   return\n\nfor x in range(N-M):\n   for y in range(N-M):\n      count = 1\n      for i in range(M):\n         if A[y+i][x:x+M] != B[i]:\n            count = 0\n      if count == 1:\n         print('Yes')\n         return\n\nprint('No')", "passed": true, "time": 0.15, "memory": 14368.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[input() for i in range(n)]\nb=[input() for j in range(m)]\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        for k in range(m):\n            if a[k+i][0+j:m+j]!=b[k]:\n                break\n        else:\n            print(\"Yes\")\n            break\n    else:\n        continue\n    break\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        flg = True\n        for k in range(M):\n            for l in range(M):\n                flg = flg & (B[k][l] == A[i+k][j+l])\n        \n        if flg:\n            ans = 'Yes'\n            print(ans)\n            return\n\nans = 'No'\nprint(ans)", "passed": true, "time": 0.21, "memory": 14168.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nA = [input() for _ in range(n)]\nB = [input() for _ in range(m)]\n\nans = 'No'\nfor i in range(n - m + 1):\n    for j in range(n - m + 1):\n        if all([A[i + k][j:j + m] == B[k] for k in range(m)]):\n            ans = 'Yes'\nprint(ans)", "passed": true, "time": 0.15, "memory": 14312.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nA = [list(input()) for _ in range(n)]\nB = [list(input()) for _ in range(m)]\nok = False\nfor ai in range(n-m+1):\n    for aj in range(n-m+1):\n        match = True\n        for bi in range(m):\n            for bj in range(m):\n                b = B[bi][bj]\n                a = A[ai+bi][aj+bj]\n                if a == b:\n                    continue\n                else:\n                    match = False\n                    break\n            if not match:\n                break\n        else:\n            ok = True\n        if ok:\n            break\n    if ok:\n        break\nprint(('Yes' if ok else 'No'))\n", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "#\n# abc054 b\n#\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n    def assertIO(self, input, output):\n        stdout, stdin = sys.stdout, sys.stdin\n        sys.stdout, sys.stdin = StringIO(), StringIO(input)\n        resolve()\n        sys.stdout.seek(0)\n        out = sys.stdout.read()[:-1]\n        sys.stdout, sys.stdin = stdout, stdin\n        self.assertEqual(out, output)\n\n    def test_\u5165\u529b\u4f8b_1(self):\n        input = \"\"\"3 2\n#.#\n.#.\n#.#\n#.\n.#\"\"\"\n        output = \"\"\"Yes\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_2(self):\n        input = \"\"\"4 1\n....\n....\n....\n....\n#\"\"\"\n        output = \"\"\"No\"\"\"\n        self.assertIO(input, output)\n\n\ndef resolve():\n    N, M = list(map(int, input().split()))\n    A = [list(input()) for _ in range(N)]\n    B = [list(input()) for _ in range(M)]\n\n    ans = \"No\"\n    for i in range(N-M+1):\n        for j in range(N-M+1):\n            ans = \"Yes\"\n            for k in range(M):\n                if ans == \"No\":\n                    break\n                for l in range(M):\n                    if A[i+k][j+l] != B[k][l]:\n                        ans = \"No\"\n                        break\n            if ans == \"Yes\":\n                break\n        if ans == \"Yes\":\n            break\n\n    print(ans)\n\n\ndef __starting_point():\n    # unittest.main()\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14540.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nA=[input() for i in range(N)]\nB=[input() for i in range(M)]\nans = \"Yes\"\nfor i in A:\n  for j in B:\n    if j not in i:\n      ans = \"No\"\nprint(ans)", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\na = [input() for i in range(n)]\nb = [input() for i in range(m)]\nans = \"Yes\"\nfor i in a:\n  for j in b:\n    if j not in i:\n      ans = \"No\"\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nfor i in range(N-M+1):\n  for j in range(N-M+1):\n    flag = True\n    AA = [a[j:j+M] for a in A[i:i+M]]\n    for a, b in zip(AA, B):\n      if a != b:\n        flag = False\n    if flag:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.24, "memory": 14228.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = []\nfor _ in range(N):\n    a = input()\n    A.append(a)\n\nB = []\nfor _ in range(M):\n    b = input()\n    B.append(b)\n\nidx = [0, 0]\nwhile True:\n    if idx[0] == N - 1 and idx[1] == N - 1:\n        break\n    if A[idx[0]][idx[1]] == B[0][0]:\n        check = False\n        for i in range(M):\n            for j in range(M):\n                if 0 <= idx[0] + i < N and 0 <= idx[1] + j < N:\n                    if A[idx[0] + i][idx[1] + j] != B[i][j]:\n                        check = True\n                        break\n                else:\n                    check = True\n                    break\n            if check:\n                break\n\n        if not check:\n            print('Yes')\n            return\n    if idx[1] < N - 1:\n        idx[1] += 1\n        continue\n    else:\n        idx[0] += 1\n        idx[1] = 1\n        continue\n\nif A[-1][-1] == B[0][0] and M == 1:\n    print('Yes')\n    return\n\nprint('No')\n", "passed": true, "time": 0.15, "memory": 14448.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[input() for i in range(n)]\nb=[input() for i in range(m)]\nans=False\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        part_a=[a[y][j:j+m] for y in range(i,i+m)]\n        cnt=0\n        for k in range(m):\n            for l in range(n-m+1):\n                if (part_a[k][l:m+l]==b[k]):\n                    cnt+=1\n        if (cnt==m):\n            ans=True\n\nif (ans):\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.26, "memory": 14380.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = []\nfor i in range(n):\n  a.append(input())\nb = []\nfor i in range(m):\n  b.append(input())\nflag = 0\njudge = []\nfor i in range(n-m+1):\n  judge = []\n  for j in range(n-m+1):\n    judge = []\n    for k in range(m):\n      judge.append(a[i+k][j:j+m])\n    if judge == b:\n      flag += 1\nif flag == 0:\n  print(\"No\")\nelse:\n  print(\"Yes\")", "passed": true, "time": 0.24, "memory": 14148.0, "status": "done"}, {"code": "import sys\n#import string\n#from collections import defaultdict, deque, Counter\n#import bisect\n#import heapq\n#import math\n#from itertools import accumulate\n#from itertools import permutations as perm\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as combr\n#from fractions import gcd\n#import numpy as np\n\nstdin = sys.stdin\nsys.setrecursionlimit(10 ** 7)\nMIN = -10 ** 9\nMOD = 10 ** 9 + 7\nINF = float(\"inf\")\nIINF = 10 ** 18\n\ndef solve():\n    n,m = list(map(int, stdin.readline().rstrip().split()))\n    #l = list(map(int, stdin.readline().rstrip().split()))\n    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n    a = [stdin.readline().rstrip() for _ in range(n)]\n    b = [stdin.readline().rstrip() for _ in range(m)]\n\n    for i in range(n-m+1):\n        for j in range(n-m+1):\n            flag = True\n            for h in range(m):\n                if a[i+h][j:j+m] != b[h]:\n                    flag = False\n                    break\n            if flag == True:\n                print(\"Yes\")\n                return\n    print(\"No\")\n\n\n\n\n\n\ndef __starting_point():\n    solve()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14384.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nA=[input() for _ in range(N)]\nB=[input() for _ in range(M)]\nfor i in range(N-M+1):\n  for j in range(N-M+1):\n    flag=1\n    for k in range(M):\n      if A[i+k][j:j+M]!=B[k]:\n        flag=0\n    if flag:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nsuccess = 0\nfor i in range(n - m + 1):\n    fail = 0\n    for j in range(n - m + 1):\n        fail = 0\n        for ii in range(m):\n            for jj in range(m):\n                if b[ii][jj] == a[i + ii][j + jj]:\n                    continue\n                else:\n                    fail = 1\n                    break\n            if fail == 1:\n                break\n        else:\n            success = 1\n            print('Yes')\n            break\n    if success == 1:\n        break\nelse:\n    if fail == 1:\n        print('No')", "passed": true, "time": 0.24, "memory": 14308.0, "status": "done"}, {"code": "n,m = map(int, input().split())\na = [input() for i in range(n)]\nb = [input() for j in range(m)]\nres = \"No\"\n\nif m == 1:\n    for i in a:\n        if b[0] in i:\n            res = \"Yes\"\nelse:\n    for k in range(n-m+1): # (0,1) \u203ba\u306e\u9577\u3055\u3092\u4e0a\u9650\u306bb\u304c\u7e26\u306b\u79fb\u52d5\u3067\u304d\u308b\u7bc4\u56f2\n        if b[0] in a[k]: # \u3082\u3057a[0]\u304ba[1]\u306bb[0]\u304c\u542b\u307e\u308c\u308b\u306a\u3089\n            for l in range(n-m+1): # (0,1) \u203ba\u306e\u9577\u3055\u3092\u4e0a\u9650\u306bb\u304c\u6a2a\u306b\u79fb\u52d5\u3067\u304d\u308b\u7bc4\u56f2\n                if b[0] == a[k][l:m+l]: # \u3082\u3057\u3001b[0]\u304ca[0/1][0:2]\u304ba[0/1][1:3]\u3068\u4e00\u81f4\u3059\u308b\u306a\u3089\n                    cnt = 0\n                    for o in range(m-1): # (0,1) b[0]\u306f\u4e00\u3057\u305f\u306e\u3067\u305d\u308c\u4ee5\u5916\n                        if b[o+1] == a[k+o+1][l:m+l]: # b[1/2]\u304ca[]\n                            cnt += 1\n                    if cnt == m-1:\n                        res = \"Yes\"\n        \nprint(res)", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nfor i in a:\n    for j in b:\n        if j not in i:\n            print('No')\n            return\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA, B = [''] * N, [''] * M\nfor i in range(N):\n    A[i] = input()\nfor i in range(M):\n    B[i] = input()\n\ndef check(x, y):\n    if x + M > N or y + M > N: return False\n    for i in range(M):\n        for j in range(M):\n            if A[x + i][y + j] != B[i][j]: return False\n    return True\n\nfor i in range(N):\n    for j in range(N):\n        if check(i, j):\n            print('Yes')\n            return\nprint('No')", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N,M=map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\n \nfor i in range(N-M+1):\n  for j in range(N-M+1):\n    t = True\n    for k in range(M):\n      if B[k] != A[i+k][j:j+M]:\n        t = False\n    if t:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.15, "memory": 14168.0, "status": "done"}, {"code": "n, m=map(int,input().split())\nA=[input() for _ in range(n)]\nB=[input() for _ in range(m)]\n\ndef dfs(y, x):\n    for Y in range(m):\n        for X in range(m):\n            if A[y+Y][x+X]!=B[Y][X]:\n                return False\n    return True\n\nans=\"No\"\nfor y in range(n-m+1):\n    for x in range(n-m+1):\n        if A[y][x]==B[0][0]:\n            if dfs(y,x):\n                ans=\"Yes\"\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = [\"\" for _ in range(n)]\nb = [\"\" for _ in range(m)]\nfor i in range(n):\n  ai = str(input())\n  a[i] = ai\nfor i in range(m):\n  bi = str(input())\n  b[i] = bi\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    flag = False\n    for k in range(m):\n      for l in range(m):\n        if a[i+k][j+l] != b[k][l]:\n          flag = True\n          break\n      if flag:\n        break\n    if not flag:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n ,m = list(map(int, input().split()))\nln = []\nlm = []\n\nfor i in range(n):\n    ln.append(input())\nfor i in range(m):\n    lm.append(input())\n\nlim = n - m + 1\nfor i in range(lim):\n    for j in range(lim):\n        l = 0\n        for k in ln[i:i+m]:\n            if k[j:j+m] != lm[l]:\n                break\n            l += 1\n        else:\n            print(\"Yes\")\n            break\n    else:\n        continue\n    break\n\nelse:\n    print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\na=[list(input()) for _ in range(n)]\nb=[list(input()) for _ in range(m)]\nr=n-m+1\nfor x in range(r**2):\n  for y in range(m**2):\n    if a[x//r+y//m][x%r+y%m]!=b[y//m][y%m]:\n      break\n  else:\n    print('Yes')\n    break\nelse:\n  print('No')\n\n", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nA = [input() for i in range(n)]\nB = [input() for i in range(m)]\n\nflag = False\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        flag = True\n        for k in range(m):\n            if B[k] != A[i+k][j:j+m]:\n                flag = False\n        if flag:\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.18, "memory": 14340.0, "status": "done"}, {"code": "N,M = map(int, input().split())\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\n\nans = \"No\"\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        flag = True\n        for k in range(M):\n            for l in range(M):\n                if A[i+k][j+l] != B[k][l]:\n                    flag = False\n                    break\n        if flag:\n            ans = \"Yes\"\n            break\nprint(ans)", "passed": true, "time": 0.15, "memory": 14148.0, "status": "done"}, {"code": "import sys\nn, m = list(map(int, input().split()))\na, b = [], []\n\nfor _ in range(n):\n    a.append(input())\nfor _ in range(m):\n    b.append(input())\n\nfor i in range(0, n-m+1):\n    for j in range(0, n-m+1):\n        for k in range(m*m):\n            if a[i+k//m][j+k%m] != b[k//m][k%m]:\n                break\n            elif k == m*m-1:\n                print('Yes')\n                return\nprint('No')\n", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\n\nans = False\nfor y in range(n-m+1):\n    for x in range(n-m+1):\n        sol = True\n        for h in range(m):\n            if a[y+h][x:x+m] != b[h]:\n                sol = False\n                break\n\n        if sol:\n            ans = True\n            break\n    if ans:\n        break\n\nprint(\"Yes\" if ans else \"No\")", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nif N < M:\n  print('No')\nelse:\n  A = [input() for _ in range(N)]\n  B = ''\n  cnt = 0\n  for _ in range(M):\n    B += input().rstrip()\n  for i in range(N-M+1):\n    if cnt==1:\n      break\n    for j in range(N-M+1):\n      judge = ''\n      for k in range(M):\n        judge += A[i+k][j:j+M]\n      if judge == B:\n        cnt += 1\n        break\n  if cnt == 1:\n    print('Yes')\n  else:\n    print('No')", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = [input() for _ in range(N)]\nB = [input() for _ in range(M)]\nflag = 0\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        if [line[j:j+M] for line in A[i:i+M]] == B:\n            flag = 1\nprint(('Yes' if flag == 1 else 'No'))\n\n", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "n, m=list(map(int,input().split()))\npic_a = [input() for _ in range(n)]\npic_b = [input() for _ in range(m)]\ntop = pic_b[0][0]\nif m==1:\n    for line_a in pic_a:\n        for chr_a in line_a:\n            if top==chr_a:\n                print('Yes')\n                return\n    print('No')\n    return\nfor i, line_a in enumerate(pic_a[:-m+1]):\n    for j, chr_a in enumerate(line_a[:-m+1]):\n        if top == chr_a:\n            for k, line_b in enumerate(pic_b):\n                if line_b != pic_a[i+k][j:j+m]:\n                    break\n            else:\n                print('Yes')\n                return\nprint('No')\n", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "N, M = map(int,input().split())\n\nA = []\nfor i in range(N):\n    A.append(input())\n\nB = []\nfor i in range(M):\n    B.append(input())\n\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        for k in range(M):\n            if A[i+k][j:j+M] != B[k]:\n                break\n            if k == M-1:\n                print(\"Yes\")\n                return\n\nprint(\"No\")", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [input() for i in range(N)]\nB = [input() for i in range(M)]\n \nfor i in range(N - M + 1):  # tate\n    for j in range(N - M + 1):  # yoko\n        ans = 1\n        for k in range(M):\n            if B[k] != A[i + k][j:j+M]:\n                ans = 0\n        if ans == 1:\n            print('Yes')\n            return\nprint('No')", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nA=[]\nB=[]\nfor i in range(n):\n    A.append(input())\nfor i in range(m):\n    B.append(input())\ncnt=0\nflag = False\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        ans = 'Yes'\n        for k in range(m):\n            for l in range(m):\n                if A[i+k][j+l]!=B[k][l]:\n                    ans = 'No'\n        else:\n            if ans == 'Yes':\n                print(ans)\n                return\nprint(ans)", "passed": true, "time": 0.2, "memory": 14320.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [''] * N\nB = [''] * M\nfor i in range(N):\n    A[i] = input()\nfor i in range(M):\n    B[i] = input()\n\nmatch_cnt = 0\nfor i in range(N - M + 1):\n    for j in range(N - M + 1):\n        flag = True\n        for y in range(M):\n            for x in range(M):\n                if A[y + i][x + j] != B[y][x]:\n                    flag = False\n        if flag:\n            match_cnt += 1\n\nif match_cnt > 0:\n    print('Yes')\nelse:\n    print('No')", "passed": true, "time": 0.19, "memory": 14164.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nA = []\nfor i in range(N):\n    a = list(input())\n    A.append(a)\nB = []\nfor i in range(M):\n    b = list(input())\n    B.append(b)\nans = \"No\"\nfor i in range(N-M+1):\n    for j in range(N-M+1):\n        if A[i][j] == B[0][0]:\n            count = 0\n            for k in range(M):\n                for l in range(M):\n                    if A[i+k][j+l] == B[k][l]:\n                        count += 1\n            if count == M*M:\n                ans = \"Yes\"\n                break\nprint(ans)", "passed": true, "time": 0.17, "memory": 14208.0, "status": "done"}, {"code": "n,m = map(int, input().split())\na = [input() for _ in range(n)]\nb = [input() for _ in range(m)]\nfor i in range(n-m+1):\n    for j in range(n-m+1):\n        tnp = 0\n        for k in range(m):\n            for l in range(m):\n                if (a[i+k][j+l]!=b[k][l]):\n                    tnp += 1\n        if (tnp==0):\n            print(\"Yes\")\n            return\nprint(\"No\")", "passed": true, "time": 0.21, "memory": 14392.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = []\nB = \"\"\nfor _ in range(N):\n  A.append(input())\nfor _ in range(M):\n  B += input()\nfor row in range(N-M+1):\n  for col in range(N-M+1):\n    tmp = \"\"\n    for p in range(M):\n      tmp += A[row+p][col:col+M]\n    if tmp == B:\n      print(\"Yes\")\n      return\nprint(\"No\")", "passed": true, "time": 0.15, "memory": 14176.0, "status": "done"}, {"code": "n,m = list(map(int, input().split()))\nma = []\nfor i in range(n):\n  ma.append(input())\n\nt = []\nfor i in range(m):\n  t.append(input())\n\nans = False\nfor i in range(n - m + 1):\n  for j in range(n - m + 1):\n    for k in range(m):\n      ll = ma[i + k][j : j + m]\n      if ll != t[k]:\n        break\n    else:\n      ans = True\n\nif ans:\n  print(\"Yes\")\nelse:\n  print(\"No\")\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n,m = map(int, input().split())\na = [[] for _ in range(n)]\nb = \"\"\nc = \"\"\nans = 0\nfor i in range(n):\n  a[i] = list(input())\nfor j in range(m):\n  b += input()\nfor i in range(n-m+1):\n  for j in range(n-m+1):\n    for k in range(i,i+m):\n      for l in range(j,j+m):\n        c += a[k][l]\n    if c == b:\n      ans += 1\n      break\n    c = \"\"\nprint(\"Yes\" if ans > 0 else \"No\")", "passed": true, "time": 0.18, "memory": 14360.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = []\nB = []\nclear = 0\nsame = 0\nfor i in range(N):\n    A.append(str(input()))\nfor i in range(M):\n    B.append(str(input()))\n\nfor i in range(N - M + 1):\n    for j in range(N - M + 1):\n        same = 0\n        for k in range(M):\n            if A[i + k][j: j + M] == B[k]:\n                same += 1\n            else:\n                break\n        if same == M:\n            clear = 1\n            break\n\nif clear == 1:\n    print('Yes')\nelse:\n    print('No')\n\n        \n", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = []\nb = []\nfor _ in range(n):\n  a.append(input())\nfor _ in range(m):\n  b.append(input())\nfor i in range(n-m+1):\n  if b[i] in a[i]:\n    for x in range(m-1):\n      if b[i+x] not in a[i+x]:\n        print(\"No\")\n        return\n    print(\"Yes\")\n    return\n  else:\n    print(\"No\")\n    return", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}]