#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAXN = 1e6 + 5;
const long long LINF = 1e18;
const double pi = 3.1415926535;
const long long MOD = 1e9 + 7;
void cyclic_roll(int &a, int &b, int &c, int &d) {
  int tmp = a;
  a = b;
  b = c;
  c = d;
  d = tmp;
}
int map1[15][15];
int map2[15][15];
int n;
bool check() {
  int nM = 0, vM = 0, hM = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (map1[i][j] == map2[i][j]) nM++;
      if (map1[n - i - 1][j] == map2[i][j]) vM++;
      if (map1[i][n - j - 1] == map2[i][j]) hM++;
    }
  }
  return nM == n * n || vM == n * n || hM == n * n;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      scanf(" %c", &c);
      if (c == 'O') map1[i][j] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      scanf(" %c", &c);
      if (c == 'O') map2[i][j] = 1;
    }
  }
  for (int i = 0; i < 4; i++) {
    if (check()) return printf("Yes\n"), 0;
    for (int i = 0; i < n / 2; i++)
      for (int j = 0; j < (n + 1) / 2; j++)
        cyclic_roll(map1[i][j], map1[n - 1 - j][i], map1[n - 1 - i][n - 1 - j],
                    map1[j][n - 1 - i]);
  }
  printf("No\n");
  return 0;
}
