#include <bits/stdc++.h>
using namespace std;
bool eq(vector<int>& v1, vector<int>& v2) {
  vector<int> cp = v2;
  reverse(v2.begin(), v2.end());
  return (v1 == v2) || (v1 == cp);
}
int main() {
  int n;
  char x;
  cin >> n;
  vector<vector<int>> m1(n, vector<int>(n)), m2(n, vector<int>(n));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      cin >> x;
      m1[i][j] = (x == 'X') ? 1 : 0;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      cin >> x;
      m2[i][j] = (x == 'X') ? 1 : 0;
    }
  vector<int> sm1, cm1, sm2, cm2;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur = 0;
    for (int j = 0; j < n; j++) cur += m1[i][j];
    sm1.push_back(cur);
  }
  for (int i = 0; i < n; i++) {
    cur = 0;
    for (int j = 0; j < n; j++) cur += m2[i][j];
    sm2.push_back(cur);
  }
  for (int j = 0; j < n; j++) {
    cur = 0;
    for (int i = 0; i < n; i++) cur += m1[i][j];
    cm1.push_back(cur);
  }
  for (int j = 0; j < n; j++) {
    cur = 0;
    for (int i = 0; i < n; i++) cur += m2[i][j];
    cm2.push_back(cur);
  }
  if (eq(sm1, sm2) && eq(cm1, cm2) || eq(sm1, cm2) && eq(cm1, sm2))
    cout << "Yes";
  else
    cout << "No";
}
