#include <bits/stdc++.h>
using namespace std;
char w[12][12], now[12][12], rn[12][12];
int n;
void check() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (w[i][j] != rn[i][j]) return;
    }
  }
  cout << "Yes";
  exit(0);
}
void init() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) rn[i][j] = now[i][j];
}
void degree() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) rn[i][j] = now[n - j + 1][i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) now[i][j] = rn[i][j];
}
int main() {
  ios::sync_with_stdio(false);
  bool t = false;
  int q;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> now[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> w[i][j];
  for (int k = 1; k <= 4; k++) {
    init();
    check();
    q = n / 2;
    for (int i = 1; i <= q; i++)
      for (int j = 1; j <= n; j++) swap(rn[i][j], rn[n - i + 1][j]);
    check();
    init();
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= q; j++) swap(rn[i][j], rn[i][n - j + 1]);
    check();
    degree();
  }
  cout << "No";
  return 0;
}
