#include <bits/stdc++.h>
using namespace std;
int n;
char a[110][110], b[110][110], c[110][110];
template <class Aqua>
inline void read(Aqua &s) {
  s = 0;
  Aqua f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = s * 10 + c - '0', c = getchar();
  s *= f;
}
void flip1() {
  for (int i = 1; i <= n / 2; i++)
    for (int j = 1; j <= n; j++) swap(b[i][j], b[n - i + 1][j]);
}
void flip2() {
  for (int i = 1; i <= n / 2; i++)
    for (int j = 1; j <= n; j++) swap(b[j][i], b[j][n - i + 1]);
}
void rotate() {
  int k = 1, l = 1;
  for (int j = n; j >= 1; j--) {
    for (int i = 1; i <= n; i++) c[i][j] = b[k][l++];
    l = 1;
    k++;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) b[i][j] = c[i][j];
}
bool check() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i][j] != b[i][j]) return 0;
  return 1;
}
void out() {}
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", a[i] + 1);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%s", b[i] + 1);
  }
  for (int i = 1; i <= 4; i++) {
    if (check()) {
      puts("Yes");
      return 0;
    }
    rotate();
    out();
    if (check()) {
      puts("Yes");
      return 0;
    }
    flip1();
    if (check()) {
      puts("Yes");
      return 0;
    }
    out();
    flip2();
    if (check()) {
      puts("Yes");
      return 0;
    }
    out();
    flip1();
    if (check()) {
      puts("Yes");
      return 0;
    }
    out();
    flip2();
    if (check()) {
      puts("Yes");
      return 0;
    }
    out();
  }
  puts("No");
  return 0;
}
