#include <bits/stdc++.h>
char a[11][11], b[11][11], c[11][11], d[11][11];
int n;
bool ok = false;
bool compare() {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (a[i][j] != b[i][j]) return false;
  return true;
}
int main() {
  std::cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) std::cin >> a[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) std::cin >> b[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) d[i][j] = a[i][j];
  for (int t = 0; t < 4; ++t) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) c[j][n - i - 1] = a[i][j];
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
    ok = ok | compare();
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) a[i][j] = c[n - i - 1][j];
  for (int t = 0; t < 4; ++t) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) c[j][n - i - 1] = a[i][j];
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
    ok = ok | compare();
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) c[i][j] = a[i][n - j - 1];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
  for (int t = 0; t < 4; ++t) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) c[j][n - i - 1] = a[i][j];
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
    ok = ok | compare();
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) a[i][j] = d[i][n - j - 1];
  for (int t = 0; t < 4; ++t) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) c[j][n - i - 1] = a[i][j];
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
    ok = ok | compare();
  }
  if (ok)
    std::cout << "Yes";
  else
    std::cout << "No";
  return 0;
}
