#include <bits/stdc++.h>
using namespace std;
int n;
char M[15][15];
char N[15][15];
int A[200];
int B[200];
int p[12] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048};
void readin(char (*P)[15], int *R) {
  int T[15][15];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char x;
      scanf("%c", &x);
      if (x == 'X')
        P[i][j] = '1';
      else
        P[i][j] = '0';
      T[i][j] = P[i][j] - '0';
    }
    getchar();
  }
  int num = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      R[num] += T[i][j] * p[n - j - 1];
    }
    num++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j >= 0; j--) {
      R[num] += T[j][i] * p[j];
    }
    num++;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = n - 1; j >= 0; j--) {
      R[num] += T[i][j] * p[j];
    }
    num++;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      R[num] += T[j][i] * p[n - j - 1];
    }
    num++;
  }
}
bool judge(int p1, int t1, int p2, int t2) {
  int tmp1[200];
  int tmp2[200];
  if (!t1) {
    int num = 0;
    for (int i = p1; i < 4 * n; i++) tmp1[num++] = A[i];
    for (int i = 0; i < p1; i++) tmp1[num++] = A[i];
  } else {
    int num = 0;
    for (int i = p1; i >= 0; i--) tmp1[num++] = A[i];
    for (int i = 4 * n - 1; i > p1; i--) tmp1[num++] = A[i];
  }
  if (!t2) {
    int num = 0;
    for (int i = p2; i < 4 * n; i++) tmp2[num++] = B[i];
    for (int i = 0; i < p2; i++) tmp2[num++] = B[i];
  } else {
    int num = 0;
    for (int i = p2; i >= 0; i--) tmp2[num++] = B[i];
    for (int i = 4 * n - 1; i > p2; i--) tmp2[num++] = B[i];
  }
  for (int i = 0; i < 4 * n; i++)
    if (tmp1[i] != tmp2[i]) return true;
  return false;
}
int main() {
  memset(M, '\0', sizeof(M));
  memset(N, '\0', sizeof(N));
  cin >> n;
  getchar();
  readin(M, A);
  readin(N, B);
  bool ans = true;
  for (int i = 0; i < 4 * n && ans; i += n)
    for (int j = 0; j < 4 * n && ans; j += n) ans = judge(i, 0, j, 0);
  for (int i = n - 1; i < 4 * n && ans; i += n)
    for (int j = n - 1; j < 4 * n && ans; j += n) ans = judge(i, 1, j, 1);
  for (int i = 0; i < 4 * n && ans; i += n)
    for (int j = n - 1; j < 4 * n && ans; j += n) ans = judge(i, 0, j, 1);
  for (int i = n - 1; i < 4 * n && ans; i += n)
    for (int j = 0; j < 4 * n && ans; j += n) ans = judge(i, 1, j, 0);
  if (!ans)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
