#include <bits/stdc++.h>
using namespace std;
char a[20][20];
char b[20][20];
char c[20][20];
char d[20][20];
int n, m;
void toli() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n / 2; j++) {
      char k;
      k = a[i][j];
      a[i][j] = a[i][n - j + 1];
      a[i][n - j + 1] = k;
    }
  }
}
void erguuleh() {
  for (int i = 1; i <= n; i++)
    for (int i1 = 1, j = n; j >= 1, i1 <= n; i1++, j--) c[i][i1] = a[j][i];
}
void erguuleh1() {
  for (int i = 1; i <= n; i++)
    for (int i1 = 1, j = n; j >= 1, i1 <= n; i1++, j--) c[i][i1] = b[j][i];
}
int duruv;
int main() {
  cin >> n;
  m = n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j], b[i][j] = a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> d[i][j];
  toli();
  duruv = 4;
  while (duruv--) {
    bool lol = true;
    erguuleh();
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (d[i][j] != c[i][j]) lol = false;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        a[i][j] = c[i][j];
      }
    }
    if (lol == true) cout << "Yes", exit(0);
  }
  duruv = 4;
  while (duruv--) {
    bool lol = true;
    erguuleh1();
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (d[i][j] != c[i][j]) lol = false;
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        b[i][j] = c[i][j];
      }
    }
    if (lol == true) cout << "Yes", exit(0);
  }
  cout << "No";
}
