#include <bits/stdc++.h>
using namespace std;
int n;
string source[20], test[20], xanti[20], vanti[20];
void print() {
  cout << "\n90\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << test[n - j - 1][i] << " ";
    }
    cout << "\n";
  }
  cout << "\n180\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << test[n - i - 1][n - j - 1] << " ";
    }
    cout << "\n";
  }
  cout << "\n270\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << test[j][n - i - 1] << " ";
    }
    cout << "\n";
  }
  cout << "\nx anti\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << test[i][n - j - 1] << " ";
    }
    cout << "\n";
  }
  cout << "\nv anti\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << test[n - i - 1][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> source[i];
  for (int i = 0; i < n; i++) cin >> test[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      xanti[i][j] = test[i][n - j - 1];
      vanti[i][j] = test[n - i - 1][j];
    }
  }
  int flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != test[i][j]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != xanti[i][j]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != vanti[i][j]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != test[n - j - 1][i]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != xanti[n - j - 1][i]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != vanti[n - j - 1][i]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != test[n - i - 1][n - j - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != vanti[n - i - 1][n - j - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != xanti[n - i - 1][n - j - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != test[j][n - i - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != xanti[j][n - i - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  flg = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (source[i][j] != vanti[j][n - i - 1]) {
        flg = 1;
        break;
      }
    }
    if (flg) break;
  }
  if (!flg) {
    cout << "Yes\n";
    return 0;
  }
  cout << "No\n";
  return 0;
}
