#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dj[] = {1, -1, 0, 0, -1, 1, 1, -1};
map<vector<string>, bool> vis;
int main() {
  int n;
  scanf("%d", &n);
  string mp[n], mp2[n];
  for (int i = 0; i < n; i++) cin >> mp[i];
  for (int i = 0; i < n; i++) cin >> mp2[i];
  bool a = 1, b = 1, c = 1, d = 1, e = 1, f = 1, g = 1, h = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      f &= mp[i][j] == mp2[j][i];
      g &= mp[i][j] == mp2[i][j];
      a &= mp[i][j] == mp2[j][n - 1 - i];
      e &= mp[i][j] == mp2[n - 1 - i][j];
      b &= mp[i][j] == mp2[n - 1 - i][n - 1 - j];
      h &= mp[i][j] == mp2[n - 1 - j][n - 1 - i];
      c &= mp[i][j] == mp2[n - 1 - j][i];
      d &= mp[i][j] == mp2[i][n - 1 - j];
    }
  }
  if (a || b || c || d || e || f || g || h)
    puts("Yes");
  else
    puts("No");
}
