#include <bits/stdc++.h>
using namespace std;
char a[15][15], b[15][15], c[15][15];
int n;
bool judge() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (a[i][j] != b[i][j]) return false;
  return true;
}
void print() {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cout << a[i][j];
    cout << endl;
  }
}
void rotate() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) c[j][n - i + 1] = a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) a[i][j] = c[i][j];
}
void y() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) c[n - i + 1][j] = a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) a[i][j] = c[i][j];
}
void x() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) c[i][n - j + 1] = a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) a[i][j] = c[i][j];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%s", a[i] + 1);
  for (int j = 1; j <= n; ++j) scanf("%s", b[j] + 1);
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  x();
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  x();
  y();
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  y();
  x();
  y();
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  rotate();
  if (judge()) {
    puts("Yes");
    return 0;
  }
  puts("No");
  return 0;
}
