import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] nm = br.readLine().split(" "); int n = Integer.parseInt(nm[0]); int m = Integer.parseInt(nm[1]); String[][] array1 = new String[n][m]; String[][] array2 = new String[n][m]; for (int i = 0; i < n * 2; i++) { String[] arr = br.readLine().split(" "); if (i < n) { for (int j = 0; j < m; j++) { array1[i][j] = arr[j]; } } else { for (int j = 0; j < m; j++) { array2[i - n][j] = arr[j]; } } } System.out.print(judge(array1, array2, n, m)); } public static String judge(String[][] arr1, String[][] arr2, int row, int column) { for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { if (!arr1[i][j].equals(arr2[i][j])) { return "No"; } } } return "Yes"; } }