#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0;
  int b = 1, c;
  while (((c = fgetc(stdin)) > '9' || c < '0') && c != '-')
    ;
  if (c == '-') b = -1, c = fgetc(stdin);
  while (c >= '0' && c <= '9') a = a * 10 + c - '0', c = fgetc(stdin);
  return a * b;
}
vector<vector<char> > a, b, c;
set<vector<vector<char> > > can;
queue<vector<vector<char> > > que;
int main() {
  int n;
  n = read();
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      a[i].push_back(0);
      while ((a[i][j] = fgetc(stdin)) != 'X' && a[i][j] != 'O')
        ;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      b[i].push_back(0);
      while ((b[i][j] = fgetc(stdin)) != 'X' && b[i][j] != 'O')
        ;
    }
  que.push(a);
  can.insert(a);
  while (!que.empty()) {
    a = que.front();
    que.pop();
    if (a == b) {
      printf("%s", "Yes");
      return 0;
    }
    c.clear();
    c.resize(n);
    for (int i = 0; i < n; i++) c[i].resize(n);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) c[j][n - i - 1] = a[i][j];
    if (!can.count(c)) {
      que.push(c);
      can.insert(c);
    }
    c.clear();
    c.resize(n);
    for (int i = 0; i < n; i++) c[i].resize(n);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) c[i][n - j - 1] = a[i][j];
    if (!can.count(c)) {
      que.push(c);
      can.insert(c);
    }
  }
  printf("%s", "No");
  return 0;
}
