n,m = map(int,input().split())
a=[]
b=[]
for i in range(n):
    a.append(input().split())
for j in range(n):
    b.append(input().split())
if a==b:
    print("Yes")
else:
    print("No")