#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<char> > a, b;
bool check() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) {
        return 0;
      }
    }
  }
  return 1;
}
void rut() {
  vector<vector<char> > s(n, vector<char>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      s[n - j - 1][i] = a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      a[i][j] = s[i][j];
    }
  }
}
void rev() {
  for (int i = 0; i < n; i++) {
    reverse(a[i].begin(), a[i].end());
  }
}
int main() {
  cin >> n;
  a.resize(n, vector<char>(n));
  b.resize(n, vector<char>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> b[i][j];
    }
  }
  for (int i = 0; i < 4; i++) {
    if (check() == 1) {
      cout << "Yes";
      return 0;
    }
    rut();
  }
  rev();
  for (int i = 0; i < 4; i++) {
    if (check() == 1) {
      cout << "Yes";
      return 0;
    }
    rut();
  }
  cout << "No";
  return 0;
}
