#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
int n;
char a[15][15], b[15][15], c[15][15], d[15][15];
bool isEqual(char a[][15], char b[][15]) {
  for (int i = (0); i <= (n - 1); ++i)
    for (int j = (0); j <= (n - 1); ++j)
      if (a[i][j] != b[i][j]) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i <= (n - 1); ++i) scanf("%s", a[i]);
  for (int i = (0); i <= (n - 1); ++i) scanf("%s", b[i]);
  for (int i = (0); i <= (3); ++i) {
    for (int x = (0); x <= (n - 1); ++x)
      for (int y = (0); y <= (n - 1); ++y) c[n - y - 1][x] = a[x][y];
    for (int x = (0); x <= (n - 1); ++x)
      for (int y = (0); y <= (n - 1); ++y) d[x][n - y - 1] = c[x][y];
    if (isEqual(b, c) || isEqual(b, d)) {
      puts("Yes");
      return 0;
    }
    for (int x = (0); x <= (n - 1); ++x)
      for (int y = (0); y <= (n - 1); ++y) a[x][y] = c[x][y];
  }
  puts("No");
  return 0;
}
