#include <bits/stdc++.h>
using namespace std;
bool horz(char m1[20][20], char m2[20][20], int n) {
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++)
      if (m1[i][j] != m2[i][j]) return false;
  return true;
}
bool vertc(char m1[20][20], char m2[20][20], int n) {
  char tmp[20][20];
  int x = n + 1;
  for (auto i = 1; i <= n; i++) {
    x--;
    for (auto j = 1; j <= n; j++) tmp[i][j] = m1[x][j];
  }
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++)
      if (tmp[i][j] != m2[i][j]) return false;
  return true;
}
void rotate(char m1[20][20], int n) {
  char tmp[20][20];
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++) tmp[i][j] = m1[n - j + 1][i];
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++) m1[i][j] = tmp[i][j];
}
int n;
char m1[20][20], m2[20][20];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++) cin >> m1[i][j];
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= n; j++) cin >> m2[i][j];
  if (horz(m1, m2, n) || vertc(m1, m2, n)) {
    cout << "Yes";
    return 0;
  }
  rotate(m1, n);
  if (horz(m1, m2, n) || vertc(m1, m2, n)) {
    cout << "Yes";
    return 0;
  }
  rotate(m1, n);
  if (horz(m1, m2, n) || vertc(m1, m2, n)) {
    cout << "Yes";
    return 0;
  }
  rotate(m1, n);
  if (horz(m1, m2, n) || vertc(m1, m2, n)) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
}
