#include <bits/stdc++.h>
using namespace std;
template <typename T>
auto operator<<(ostream& out, T& container)
    -> decltype(container.begin(), container.end(), out) {
  bool first = true;
  out << "[";
  for (auto it = container.begin(); it != container.end(); ++it) {
    if (!first) out << ", ";
    out << *it;
    first = false;
  }
  return out << "]";
}
int n;
char a[10][10];
char b[10][10];
void check() {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (a[i][j] != b[i][j]) return;
  cout << "Yes\n";
  exit(0);
}
void rotate() {
  char c[10][10];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) c[i][j] = a[n - j - 1][i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
}
void flipHorizontal() {
  char c[10][10];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) c[i][j] = a[n - i - 1][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) a[i][j] = c[i][j];
}
void flipVertical() {
  char c[10][10];
  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];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) cin >> a[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) cin >> b[i][j];
  for (int i = 0; i < 4; ++i) {
    rotate();
    check();
  }
  flipHorizontal();
  check();
  for (int i = 0; i < 4; ++i) {
    rotate();
    check();
  }
  flipHorizontal();
  flipVertical();
  check();
  for (int i = 0; i < 4; ++i) {
    rotate();
    check();
  }
  flipHorizontal();
  for (int i = 0; i < 4; ++i) {
    rotate();
    check();
  }
  cout << "No\n";
}
