#include <bits/stdc++.h>
int n;
char a[11][11], b[11][11], c[11][11];
void turn() {
  int i, j, k, l;
  for (i = n - 1, k = 0; i >= 0; --i, ++k)
    for (j = 0, l = 0; j < n; ++j, ++l) c[k][l] = a[j][i];
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) a[i][j] = c[i][j];
}
int same() {
  int i, j;
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j)
      if (a[i][j] != b[i][j]) return 0;
  return 1;
}
void p() {
  int i, j;
  printf("\n\n");
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) printf("%c", a[i][j]);
    printf("\n");
  }
  printf("\n\n");
}
void f() {
  int i, j;
  for (i = 0; i < 3; ++i) {
    if (same()) {
      printf("Yes\n");
      return;
    }
    turn();
  }
  if (same()) {
    printf("Yes\n");
    return;
  }
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) c[i][j] = a[i][n - j - 1];
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) a[i][j] = c[i][j];
  for (i = 0; i < 3; ++i) {
    if (same()) {
      printf("Yes\n");
      return;
    }
    turn();
  }
  if (same()) {
    printf("Yes\n");
    return;
  }
  printf("No\n");
  return;
}
int main() {
  scanf("%d", &n);
  int i, j;
  for (i = 0; i < n; ++i) scanf("%s", a[i]);
  for (i = 0; i < n; ++i) scanf("%s", b[i]);
  f();
  return 0;
}
