#include <bits/stdc++.h>
using namespace std;
void JIZZ(string output = "") {
  cout << output;
  exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-13;
const long long mod = 1e9 + 7;
char a[13][13], b[13][13], c[13][13];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%s", a[i] + 1);
  for (int i = 1; i <= n; ++i) scanf("%s", b[i] + 1);
  for (int i = 0; i < 4; ++i) {
    if ([&]() {
          for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
              if (a[i][j] != b[i][j]) return 0;
          return 1;
        }()) {
      cout << "Yes" << endl;
      exit(0);
    }
    if ([&]() {
          for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
              if (a[i][j] != b[i][n + 1 - j]) return 0;
          return 1;
        }()) {
      cout << "Yes" << endl;
      exit(0);
    }
    if ([&]() {
          for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
              if (a[i][j] != b[n + 1 - i][j]) return 0;
          return 1;
        }()) {
      cout << "Yes" << endl;
      exit(0);
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        c[j][n + 1 - i] = a[i][j];
      }
    }
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j) a[i][j] = c[i][j];
  }
  cout << "No" << endl;
}
