#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const int maxn = 5e1 + 10;
const int maxq = 1e3 + 10;
const int alf = 26;
const long long dlm = 1e9 + 7;
const int del = 998244353;
const int eps = 1e-7;
char t[maxn][maxn];
char g[maxn][maxn];
char t2[maxn][maxn];
int n;
void rot() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      t2[j][n + 1 - i] = t[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      t[i][j] = t2[i][j];
    }
  }
}
int flh() {
  for (int i1 = 1, i2 = n; i1 < i2; i1++, i2--) {
    for (int j = 1; j <= n; j++) {
      swap(t[i1][j], t[i2][j]);
    }
  }
}
int flv() {
  for (int i = 1; i <= n; i++) {
    for (int j1 = 1, j2 = n; j1 < j2; j1++, j2--) {
      swap(t[i][j1], t[i][j2]);
    }
  }
}
int same() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (t[i][j] != g[i][j]) return 0;
    }
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string st;
    cin >> st;
    for (int j = 1; j <= n; j++) {
      t[i][j] = st[j - 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    string st;
    cin >> st;
    for (int j = 1; j <= n; j++) {
      g[i][j] = st[j - 1];
    }
  }
  for (int vaf = 0; vaf < 2; vaf++) {
    for (int haf = 0; haf < 2; haf++) {
      for (int r = 0; r < 4; r++) {
        if (same() == 1) {
          return cout << "Yes", 0;
        }
        rot();
      }
      flh();
    }
    flv();
  }
  cout << "No";
}
