#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, w = 0, n, v, r = 0, x, l, k, y, z;
  cin >> n;
  char a[n][n], b[n][n], b1[n][n], b2[n][n], b3[n][n], b4[n][n];
  int c[8] = {0};
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> b[i][j];
      b1[i][j] = b[i][j];
      b2[i][n - 1 - j] = b[i][j];
      b3[n - 1 - i][j] = b[i][j];
      b4[n - 1 - i][n - 1 - j] = b[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] == b1[i][j]) c[0]++;
      if (a[i][j] == b2[i][j]) c[1]++;
      if (a[i][j] == b3[i][j]) c[2]++;
      if (a[i][j] == b4[i][j]) c[3]++;
      if (a[j][i] == b1[i][j]) c[4]++;
      if (a[j][i] == b2[i][j]) c[5]++;
      if (a[j][i] == b3[i][j]) c[6]++;
      if (a[j][i] == b4[i][j]) c[7]++;
    }
  }
  for (i = 0; i < 8; i++) {
    if (r < c[i]) r = c[i];
  }
  if (r == n * n)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
