#include <bits/stdc++.h>
using namespace std;
const int N = 15;
int n;
char a[N][N], b[N][N], c[N][N];
void rotate() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      c[i][j] = a[j][n - i + 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = c[i][j];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> b[i][j];
    }
  }
  bool ok = false;
  for (int t = 1; t <= 4; t++) {
    bool cek = true, cek2 = true, cek3 = true;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        cek &= a[i][j] == b[i][j];
        cek2 &= a[n - i + 1][j] == b[i][j];
        cek3 &= a[i][n - j + 1] == b[i][j];
      }
    }
    ok |= cek, ok |= cek2, ok |= cek3;
    rotate();
  }
  puts(ok ? "Yes" : "No");
  return 0;
}
