#include <bits/stdc++.h>
using namespace std;
int n;
string a[10], b[10];
bool ans;
int B(int i, int j, int k) {
  switch (k) {
    case 0:
      return b[i][j];
      break;
    case 1:
      return b[j][i];
      break;
    case 2:
      return b[n - 1 - i][n - 1 - j];
      break;
    case 3:
      return b[n - 1 - j][n - 1 - i];
      break;
    case 4:
      return b[i][n - 1 - j];
      break;
    case 5:
      return b[n - 1 - i][j];
      break;
    case 6:
      return b[j][n - 1 - i];
      break;
    case 7:
      return b[n - 1 - j][i];
      break;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int k = 0; k < 8 && !ans; ++k) {
    ans = true;
    for (int i = 0; i < n && ans; ++i)
      for (int j = 0; j < n && ans; ++j)
        if (a[i][j] != B(i, j, k)) ans = false;
  }
  if (ans)
    cout << "Yes";
  else
    cout << "No";
  getchar();
  getchar();
  return 0;
}
