#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[10][10], b[10][10];
  int n, m, ans = 0;
  bool bb[8] = {true};
  for (int i = 0; i < 8; i++) bb[i] = true;
  scanf("%d", &n);
  m = n - 1;
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  for (int i = 0; i < n; i++) scanf("%s", b[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) bb[0] = false;
      if (a[j][m - i] != b[i][j]) bb[1] = false;
      if (a[m - i][m - j] != b[i][j]) bb[2] = false;
      if (a[m - j][i] != b[i][j]) bb[3] = false;
      if (a[m - i][j] != b[i][j]) bb[4] = false;
      if (a[m - j][m - i] != b[i][j]) bb[5] = false;
      if (a[i][m - j] != b[i][j]) bb[6] = false;
      if (a[j][i] != b[i][j]) bb[7] = false;
    }
  for (auto i : bb) ans = ans || i;
  if (ans)
    printf("Yes");
  else
    printf("No");
  return 0;
}
