#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e9 + 7, S = 11;
long long int n;
char s[S][S], x[S][S];
bool fn(long long int a) {
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < n; j++) {
      long long int p = n - 1 - i, q = n - 1 - j;
      pair<long long int, long long int> b;
      if (a == 0) {
        b = {i, j};
      }
      if (a == 1) {
        b = {p, j};
      }
      if (a == 2) {
        b = {i, q};
      }
      if (a == 3) {
        b = {p, q};
      }
      if (a == 4) {
        b = {j, i};
      }
      if (a == 5) {
        b = {j, p};
      }
      if (a == 6) {
        b = {q, i};
      }
      if (a == 7) {
        b = {q, p};
      }
      if (s[i][j] != x[b.first][b.second]) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    cin >> n;
    for (long long int i = 0; i < n; i++) {
      cin >> s[i];
    }
    for (long long int i = 0; i < n; i++) {
      cin >> x[i];
    }
    for (long long int i = 0; i < 8; i++) {
      if (fn(i)) {
        cout << "Yes";
        return 0;
      }
    }
    cout << "No";
  }
  return 0;
}
