#include <bits/stdc++.h>
using namespace std;
int n, m, flag;
int ar[101][101], ars[101][101], c[101][101], q[101][101];
int fu() {
  int y = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (ars[i][j] != c[i][j]) y = 0;
  return y;
}
void f() {
  flag = max(flag, fu());
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) q[i][j] = c[j][n - i - 1];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) c[i][j] = q[i][j];
  flag = max(flag, fu());
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) q[i][j] = c[j][n - i - 1];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) c[i][j] = q[i][j];
  flag = max(flag, fu());
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) q[i][j] = c[j][n - i - 1];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) c[i][j] = q[i][j];
  flag = max(flag, fu());
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      char a;
      cin >> a;
      if (a == 'X')
        ar[i][j] = 0;
      else
        ar[i][j] = 1;
      c[i][j] = ar[i][j];
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      char a;
      cin >> a;
      if (a == 'X')
        ars[i][j] = 0;
      else
        ars[i][j] = 1;
    }
  f();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) c[i][j] = ar[n - i - 1][j];
  f();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) c[i][j] = ar[i][n - j - 1];
  f();
  if (flag) {
    cout << "Yes";
  } else
    cout << "No";
  return 0;
}
