#include <bits/stdc++.h>
using namespace std;
const int N = 15;
const int M = 1e9 + 7;
const double eps = 1e-6;
const double PI(acos(-1.0));
int n;
char b[N][N], a[N][N], c[N][N];
bool check() {
  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;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  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];
  if (check()) {
    cout << "Yes\n";
    return 0;
  }
  for (int k = 0; k < (4); k++) {
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        c[i][j] = a[j][n + 1 - i];
      }
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        a[i][j] = c[i][j];
      }
    if (check()) {
      cout << "Yes\n";
      return 0;
    }
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      c[i][j] = a[i][n + 1 - j];
    }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      a[i][j] = c[i][j];
    }
  if (check()) {
    cout << "Yes\n";
    return 0;
  }
  for (int k = 0; k < (4); k++) {
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        c[i][j] = a[j][n + 1 - i];
      }
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        a[i][j] = c[i][j];
      }
    if (check()) {
      cout << "Yes\n";
      return 0;
    }
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      c[i][j] = a[i][n + 1 - j];
    }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      a[i][j] = c[i][j];
    }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      c[i][j] = a[n + 1 - i][j];
    }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) {
      a[i][j] = c[i][j];
    }
  for (int k = 0; k < (4); k++) {
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        c[i][j] = a[j][n + 1 - i];
      }
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++) {
        a[i][j] = c[i][j];
      }
    if (check()) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}
