Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")


Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("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)]

l = 0
w = len(A[0])
while l <= len(A) - len(B):
	for n in range(len(A) - len(B)):
		if B[0] not in A[n][l:]:
			continue
		if 0 == A[n][l:].index(B[0]):
			for m in range(1, len(B)):
				if 0 != A[n + m][l:].index(B[m]):
					break
				else:
					#print(n, m)
					print("Yes")
					exit()
	l += 1
print("No")


Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("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)]

l = 0
w = len(A[0])
while l <= len(A[0]) - len(B[0]):
	for n in range(len(A) - len(B)):
		if B[0] not in A[n][l:]:
			continue
		if 0 == A[n][l:].index(B[0]):
			for m in range(1, len(B)):
				if 0 != A[n + m][l:].index(B[m]):
					break
				else:
					#print(n, m)
					print("Yes")
					exit()
	l += 1
print("No")


Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")

Buggy python submission (verdict: Runtime Error):
def INSTR():
	return input()

def INNUM():
	return int(INSTR())

def INSTR_S():
	return INSTR().split()

def INNUM_S():
	return map(int, INSTR_S())

def INSTR_M(n):
	return [INSTR() for _ in range(n)]

def INNUM_SM(n):
	return [tuple(INNUM_S()) for _ in range(n)]

N, M = INNUM_S()
NPIC = INSTR_M(N)
MPIC = INSTR_M(M)

for i, npic in enumerate(NPIC):
	if MPIC[0] in npic:
		c = npic.find(MPIC[0])
		for j, mpic in enumerate(MPIC):
			if c != NPIC[i + j].find(mpic):
				break
		else:
			print("Yes")
			exit()
print("No")


Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")