#include <bits/stdc++.h>
using namespace std;
int n;
string m1[10], m2[10];
bool issame() {
  bool flag = true;
  ;
  for (int i = 0; i < n; ++i)
    if (m1[i] != m2[i]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 0; i < n; ++i)
    if (m1[i] != m2[n - i - 1]) flag = false;
  if (flag) return true;
  flag = true;
  for (int i = 0; i < n; ++i) {
    string s = m2[i];
    reverse(s.begin(), s.end());
    if (m1[i] != s) flag = false;
  }
  if (flag) return true;
  return false;
}
int rotateby90() {
  string m[10], s = "";
  for (int i = 0; i < n; ++i) {
    s = "";
    for (int j = 0; j < n; ++j) s += m2[j][n - i - 1];
    m[i] = s;
  }
  for (int i = 0; i < n; ++i) {
    m2[i] = m[i];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  srand(time(NULL));
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> m1[i];
  for (int i = 0; i < n; ++i) cin >> m2[i];
  if (issame()) {
    cout << "YES";
    return 0;
  }
  rotateby90();
  if (issame()) {
    cout << "YES";
    return 0;
  }
  rotateby90();
  if (issame()) {
    cout << "YES";
    return 0;
  }
  rotateby90();
  if (issame()) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
  return 0;
}
