#include <bits/stdc++.h>
char s1[20][20], s2[20][20];
char dat[20][20];
int N;
void rot() {
  int cur = N;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      dat[N - j + 1][cur] = s1[i][j];
    }
    --cur;
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      s1[i][j] = dat[i][j];
    }
  }
}
bool same() {
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      if (s1[i][j] != s2[i][j]) return false;
    }
  }
  return true;
}
void rev() {
  int cur = N;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      dat[cur][j] = s1[i][j];
    }
    cur--;
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      s1[i][j] = dat[i][j];
    }
  }
}
void rev2() {
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      dat[i][N - j + 1] = s1[i][j];
    }
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= N; ++j) {
      s1[i][j] = dat[i][j];
    }
  }
}
int main(int argc, char *argv[]) {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%s", s1[i] + 1);
  for (int i = 1; i <= N; ++i) scanf("%s", s2[i] + 1);
  rev();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rev();
  rev2();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rev2();
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  rev();
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  rev();
  rev2();
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  rev2();
  rev();
  rev2();
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  rev2();
  rev();
  rev2();
  rev();
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  if (same()) {
    puts("Yes");
    return 0;
  }
  rot();
  rev();
  rev2();
  puts("No");
  return 0;
}
