#include <bits/stdc++.h>
const int MAXN = 5 * 1e5 + 1;
int N;
int main() {
  std::cin >> N;
  char G[N + 1][N + 1];
  char G1[N + 1][N + 1];
  char G90[N + 1][N + 1], G180[N + 1][N + 1], G270[N + 1][N + 1];
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      std::cin >> G[i][j];
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      std::cin >> G1[i][j];
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      G90[j][N - i + 1] = G[i][j];
      G180[N - i + 1][N - j + 1] = G[i][j];
      G270[N - j + 1][i] = G[i][j];
    }
  }
  bool b0 = true, b90 = true, b180 = true, b270 = true;
  bool b1 = true, b2 = true, b3 = true, b4 = true;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if (G1[i][j] != G[N - i + 1][j]) b0 = false;
      if (G1[i][j] != G90[N - i + 1][j]) b90 = false;
      if (G1[i][j] != G180[N - i + 1][j]) b180 = false;
      if (G1[i][j] != G270[N - i + 1][j]) b270 = false;
      if (G1[i][j] != G[i][j]) b1 = false;
      if (G1[i][j] != G90[i][j]) b2 = false;
      if (G1[i][j] != G180[i][j]) b3 = false;
      if (G1[i][j] != G270[i][j]) b4 = false;
    }
  }
  if (b0 || b90 || b180 || b270 || b1 || b2 || b3 || b4) {
    std::cout << "Yes";
  } else {
    std::cout << "No";
  }
  return 0;
  std::cout << "90: " << std::endl;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      std::cout << G90[i][j];
    }
    std::cout << std::endl;
  }
  std::cout << std::endl << "180: " << std::endl;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      std::cout << G180[i][j];
    }
    std::cout << std::endl;
  }
  std::cout << std::endl << "270: " << std::endl;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      std::cout << G270[i][j];
    }
    std::cout << std::endl;
  }
  std::cout << "No";
  return 0;
}
