#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
template <typename T>
inline void Min(T &x, T y) {
  if (x > y) x = y;
}
template <typename T>
inline void Max(T &x, T y) {
  if (x < y) x = y;
}
const int maxn = 20;
int n;
char s1[maxn][maxn], s2[maxn][maxn], s[maxn][maxn];
inline bool check() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (s[i][j] != s2[i][j]) return 0;
  }
  return 1;
}
inline void rot() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) s[n - j + 1][i] = s1[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) s1[i][j] = s[i][j];
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) scanf("%s", s1[i] + 1);
  for (int i = 1; i <= n; i++) scanf("%s", s2[i] + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) s[i][j] = s1[i][j];
  }
  if (check()) return puts("Yes"), 0;
  for (int p = 1; p <= 4; p++) {
    rot();
    if (check()) return puts("Yes"), 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) s[i][j] = s1[i][n - j + 1];
    if (check()) return puts("Yes"), 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) s[i][j] = s1[n - i + 1][j];
    if (check()) return puts("Yes"), 0;
  }
  puts("No");
  return 0;
}
