#include <bits/stdc++.h>
using namespace std;
int R, C;
string arr[20], arr1[20];
void reverseColumns() {
  for (int i = 0; i < C; i++)
    for (int j = 0, k = C - 1; j < k; j++, k--) swap(arr[j][i], arr[k][i]);
}
void transpose() {
  for (int i = 0; i < R; i++)
    for (int j = i; j < C; j++) swap(arr[i][j], arr[j][i]);
}
void rotate90() {
  transpose();
  reverseColumns();
}
bool chk1(string brr[]) {
  for (int i = 0; i < R; i++) {
    for (int j = 0; j < R; j++) {
      if (arr1[i][j] != brr[i][j]) {
        return 0;
      }
    }
  }
  return 1;
}
bool chk() {
  for (int i = 0; i < R; i++) {
    for (int j = 0; j < R; j++) {
      if (arr1[i][j] != arr[i][j]) {
        return 0;
      }
    }
  }
  return 1;
}
int main() {
  cin >> R;
  C = R;
  for (int i = 0; i < R; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < R; i++) {
    cin >> arr1[i];
  }
  bool flag = 0;
  if (arr == arr1) flag = 1;
  for (int i = 0; i < 4; i++) {
    rotate90();
    if (chk()) flag = 1;
    if (arr1 == arr) flag = 1;
    string brr[20];
    for (int i = 0; i < R; i++) brr[i] += arr[i];
    for (int i = 0; i < R; i++) reverse(brr[i].begin(), brr[i].end());
    if (chk1(brr)) flag = 1;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
