#include <bits/stdc++.h>
using namespace std;
char a[15][15], b[15][15], c[15][15], d[15][15];
void reverse_(int n) {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      c[j][n - i + 1] = b[i][j];
    }
}
void symmetry(int n) {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      c[i][n - j + 1] = b[i][j];
    }
}
bool judge(int n) {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (c[i][j] != a[i][j]) return false;
    }
  return true;
}
int main() {
  int n;
  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];
      c[i][j] = b[i][j];
    }
  for (int k = 1; k <= 4; k++) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) b[i][j] = c[i][j];
    if (judge(n)) {
      cout << "Yes" << endl;
      return 0;
    }
    symmetry(n);
    if (judge(n)) {
      cout << "Yes" << endl;
      return 0;
    }
    reverse_(n);
  }
  cout << "No" << endl;
  return 0;
}
