#include <bits/stdc++.h>
using namespace std;
char mapa[15][15];
char mapb[15][15];
bool match(char mapa[][15], char mapb[][15], int n) {
  bool flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[i][j] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[n - i + 1][j] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[i][n - j + 1] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[n - i + 1][n - j + 1] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[j][i] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[n - j + 1][i] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[j][n - i + 1] != mapb[i][j]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mapa[n - j + 1][n - i + 1] != mapb[i][j]) flag = false;
  if (flag) return true;
  return false;
}
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> mapa[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> mapb[i][j];
  cout << (match(mapa, mapb, n) ? "YES" : "NO");
}
int main() {
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
