#include <bits/stdc++.h>
using namespace std;
int N;
char c1[15][15], c2[15][15], c3[15][15];
void rotate() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c3[N - j - 1][i] = c1[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c1[i][j] = c3[i][j];
}
void v() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c3[N - i - 1][j] = c1[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c1[i][j] = c3[i][j];
}
void h() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c3[i][N - j - 1] = c1[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) c1[i][j] = c3[i][j];
}
bool b() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      if (c1[i][j] != c2[i][j]) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) cin >> c1[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) cin >> c2[i][j];
  for (int i = 0; i < 4; i++) {
    rotate();
    v();
    if (b()) {
      cout << "Yes";
      return 0;
    }
    h();
    if (b()) {
      cout << "Yes";
      return 0;
    }
    v();
    if (b()) {
      cout << "Yes";
      return 0;
    }
    h();
    if (b()) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
