#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9 + 7;
int n;
string rotate(string s) {
  char grid[11][11];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) grid[i][j] = s[i * n + j];
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j) swap(grid[i][j], grid[j][i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n / 2; ++j) swap(grid[i][j], grid[i][n - j - 1]);
  string ret;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) ret += grid[i][j];
  return ret;
}
string flipVer(string s) {
  char grid[11][11];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) grid[i][j] = s[i * n + j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n / 2; ++j) swap(grid[i][j], grid[i][n - j - 1]);
  string ret;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) ret += grid[i][j];
  return ret;
}
string flipHor(string s) {
  char grid[11][11];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) grid[i][j] = s[i * n + j];
  for (int j = 0; j < n; ++j)
    for (int i = 0; i < n / 2; ++i) swap(grid[i][j], grid[n - i - 1][j]);
  string ret;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) ret += grid[i][j];
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  string s1, s2;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    s1 += s;
  }
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    s2 += s;
  }
  vector<string> v1, v2;
  v1.push_back(s1);
  v1.push_back(flipHor(s1));
  v1.push_back(flipVer(s1));
  v1.push_back(rotate(s1));
  v1.push_back(rotate(v1.back()));
  v1.push_back(rotate(v1.back()));
  v2.push_back(s2);
  v2.push_back(flipHor(s2));
  v2.push_back(flipVer(s2));
  v2.push_back(rotate(s2));
  v2.push_back(rotate(v2.back()));
  v2.push_back(rotate(v2.back()));
  for (int i = 0; i < (int)(v1).size(); ++i) {
    for (int j = 0; j < (int)(v2).size(); ++j) {
      if (v1[i] == v2[j]) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  cin.ignore();
  cin.get();
}
