#include <bits/stdc++.h>
using namespace std;
int n;
char a[15][15], b[15][15], c[15][15], d[15][15];
void cp() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) c[i][j] = a[i][j];
}
bool ok() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (c[i][j] != b[i][j]) return false;
  return true;
}
void f1() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      d[i][j] = c[n - j + 1][i];
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) c[i][j] = d[i][j];
  if (ok()) {
    puts("Yes");
    exit(0);
  }
}
void f2() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      d[i][j] = c[n - i + 1][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) c[i][j] = a[i][j];
  }
  if (ok()) {
    puts("Yes");
    exit(0);
  }
}
void f3() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      d[i][j] = c[i][n - j + 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) c[i][j] = d[i][j];
  }
  if (ok()) {
    puts("Yes");
    exit(0);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> b[i][j];
  cp();
  f1();
  f1();
  f1();
  cp();
  f2();
  f1();
  f1();
  f1();
  cp();
  f3();
  f1();
  f1();
  f1();
  puts("No");
}
