#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum;
  char a[11][11], s[11][11];
  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 >> s[i][j];
    }
  }
  int q1 = 0, q2 = 0, q3 = 0, q4 = 0, q5 = 0, q6 = 0, q7 = 0, q8 = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (s[i][j] == a[i][j]) q1++;
      if (s[i][j] == a[i][n - j - 1]) q2++;
      if (s[i][j] == a[j][n - i - 1]) q3++;
      if (s[i][j] == a[n - j - 1][n - i - 1]) q4++;
      if (s[i][j] == a[n - i - 1][n - j - 1]) q5++;
      if (s[i][j] == a[n - i - 1][j]) q6++;
      if (s[i][j] == a[n - j - 1][i]) q7++;
      if (s[i][j] == a[j][i]) q8++;
    }
  }
  int w = n * n;
  if (q1 == w || q2 == w || q3 == w || q4 == w || q5 == w || q6 == w ||
      q7 == w || q8 == w) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
  return 0;
}
