#include <bits/stdc++.h>
using namespace std;
const int maxn = 11;
int n;
char A[maxn][maxn], B[maxn][maxn], C[maxn][maxn], D[maxn][maxn];
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 rotate() {
  int col = n;
  int row = 1;
  while (row <= n) {
    for (int i = 1; i <= n; i++) C[i][col] = A[row][i];
    row++;
    col--;
  }
}
void flip1() {
  int row1 = 1;
  int row2 = n;
  while (row1 <= n) {
    for (int i = 1; i <= n; i++) C[row2][i] = A[row1][i];
    row1++;
    row2--;
  }
}
void flip2() {
  int col1 = 1;
  int col2 = n;
  while (col1 <= n) {
    for (int i = 1; i <= n; i++) C[i][col2] = A[i][col1];
    col1++;
    col2--;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  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];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) C[i][j] = A[i][j];
  if (ok()) {
    cout << "Yes" << '\n';
    return 0;
  }
  flip1();
  if (ok()) {
    cout << "Yes" << '\n';
    return 0;
  }
  flip2();
  if (ok()) {
    cout << "Yes" << '\n';
    return 0;
  }
  for (int i = 0; i < 3; i++) {
    rotate();
    if (ok()) {
      cout << "Yes" << '\n';
      return 0;
    }
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= n; k++) A[j][k] = C[j][k];
    flip1();
    if (ok()) {
      cout << "Yes" << '\n';
      return 0;
    }
    flip2();
    if (ok()) {
      cout << "Yes" << '\n';
      return 0;
    }
  }
  cout << "No" << '\n';
  return 0;
}
