#include <bits/stdc++.h>
using namespace std;
char a[10][10], b[10][10];
int n, ok[8];
struct matrix {
  char m[10][10];
} v[7];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> b[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      v[0].m[j][n - i - 1] = v[1].m[n - i - 1][n - j - 1] =
          v[2].m[n - j - 1][i] = v[3].m[i][n - j - 1] =
              v[4].m[n - j - 1][n - i - 1] = v[5].m[n - i - 1][j] =
                  v[6].m[j][i] = b[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) ok[0] = 1;
      if (a[i][j] != v[0].m[i][j]) ok[1] = 1;
      if (a[i][j] != v[1].m[i][j]) ok[2] = 1;
      if (a[i][j] != v[2].m[i][j]) ok[3] = 1;
      if (a[i][j] != v[3].m[i][j]) ok[4] = 1;
      if (a[i][j] != v[4].m[i][j]) ok[5] = 1;
      if (a[i][j] != v[5].m[i][j]) ok[6] = 1;
      if (a[i][j] != v[6].m[i][j]) ok[7] = 1;
    }
  if (ok[0] && ok[1] && ok[2] && ok[3] && ok[4] && ok[5] && ok[6] && ok[7])
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
