#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, i, j;
  cin >> n;
  vector<vector<char> > vec(n, vector<char>(n));
  vector<vector<char> > arr(n, vector<char>(n));
  vector<pair<int, int> > surf(8);
  vector<bool> burf(8, true);
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      cin >> vec[i][j];
    }
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      cin >> arr[i][j];
    }
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      surf = {{i, j},
              {j, i},
              {n - 1 - j, i},
              {n - 1 - i, n - 1 - j},
              {n - 1 - j, n - 1 - i},
              {i, n - 1 - j},
              {j, n - 1 - i},
              {n - 1 - i, j}};
      for (int k = 0; k < 8; ++k) {
        if (vec[i][j] != arr[surf[k].first][surf[k].second]) {
          burf[k] = false;
        }
      }
    }
  }
  for (i = 0; i < 8; ++i) {
    if (burf[i]) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}
