Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')


Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        p = []
        for k in range(m):
            p.append(a[i:i+m][k][j:j+m])
        if p == b:
            exits = True

print('Yes' if exits else 'No')

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n):
    for j in range(m):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')


Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        p = []
        for k in range(m):
            p.append(a[i:i+m][k][j:j+m])
        if p == b:
            exits = True

print('Yes' if exits else 'No')

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n):
    for j in range(n):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')


Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        p = []
        for k in range(m):
            p.append(a[i:i+m][k][j:j+m])
        if p == b:
            exits = True

print('Yes' if exits else 'No')

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')


Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        p = []
        for k in range(m):
            p.append(a[i:i+m][k][j:j+m])
        if p == b:
            exits = True

print('Yes' if exits else 'No')