#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
const int N = 20;
bool same(char a[N][N], char b[N][N], int n) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] != b[i][j]) return false;
    }
  }
  return true;
}
char a[N][N], b[N][N];
void rotate(char a[N][N], int n) {
  static char c[N][N];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      c[i][j] = a[n - 1 - j][i];
    }
  }
  memcpy(a, c, sizeof(c));
}
void flip_hor(char s[N][N], int n) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n / 2; ++j) {
      swap(a[i][j], a[i][n - 1 - j]);
    }
  }
}
void flip_ver(char a[N][N], int n) {
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i < n / 2; ++i) {
      swap(a[i][j], a[n - 1 - i][j]);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%s", b[i]);
  }
  for (int k = 0; k < 4; ++k) {
    if (same(a, b, n)) {
      puts("Yes");
      return 0;
    }
    rotate(a, n);
  }
  flip_hor(a, n);
  for (int k = 0; k < 4; ++k) {
    if (same(a, b, n)) {
      puts("Yes");
      return 0;
    }
    rotate(a, n);
  }
  flip_ver(a, n);
  for (int k = 0; k < 4; ++k) {
    if (same(a, b, n)) {
      puts("Yes");
      return 0;
    }
    rotate(a, n);
  }
  puts("No");
  return 0;
}
