#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int n;
char a[N][N], b[N][N];
inline bool ok(char a[N][N], char b[N][N]) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] != b[i][j]) return 0;
    }
  }
  return 1;
}
inline void rotate(char a[N][N]) {
  char b[n][n];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      b[i][j] = a[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      a[j][n - 1 - i] = b[i][j];
    }
  }
}
inline void flip(char a[N][N]) {
  char b[n][n];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      b[i][j] = a[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      a[j][i] = b[i][j];
    }
  }
}
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 < 4; ++i, rotate(a)) {
    if (ok(a, b)) {
      cout << "YES\n";
      return 0;
    }
    flip(a);
    if (ok(a, b)) {
      cout << "YES\n";
      return 0;
    }
    flip(a);
  }
  cout << "NO";
  return 0;
}
