#include <bits/stdc++.h>
using namespace std;
void rotate(std::vector<string>& mp1, std::vector<string>& newmp) {
  int n = mp1.size();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      newmp[j][n - 1 - i] = mp1[i][j];
    }
  }
}
void flip_horizontal(std::vector<string>& mp1, std::vector<string>& newmp) {
  int n = mp1.size();
  for (int i = 0; i < n; ++i) {
    newmp[i] = mp1[i];
    for (int j = 0, k = n - 1; j < k; ++j, --k) {
      char t = newmp[i][j];
      newmp[i][j] = newmp[i][k];
      newmp[i][k] = t;
    }
  }
}
void flip_vertical(std::vector<string>& mp1, std::vector<string>& newmp) {
  int n = mp1.size();
  for (int i = 0; i < n; ++i) {
    newmp[i] = mp1[i];
  }
  for (int j = 0; j < n; ++j) {
    for (int i = 0, k = n - 1; i < k; ++i, --k) {
      char t = newmp[i][j];
      newmp[i][j] = newmp[k][j];
      newmp[k][j] = t;
    }
  }
}
bool isSame(std::vector<string>& mp1, std::vector<string>& mp2) {
  int n = mp1.size();
  for (int i = 0; i < n; ++i) {
    if (mp1[i] != mp2[i]) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  string tmp;
  std::vector<string> mp1;
  std::vector<string> mp2;
  while (cin >> n) {
    bool flag = false;
    for (int i = 0; i < n; ++i) {
      cin >> tmp;
      mp1.push_back(tmp);
    }
    for (int i = 0; i < n; ++i) {
      cin >> tmp;
      mp2.push_back(tmp);
    }
    if (isSame(mp1, mp2)) {
      flag = true;
    } else {
      std::vector<string> newmp(mp1);
      flip_horizontal(mp1, newmp);
      if (isSame(newmp, mp2)) {
        flag = true;
      } else {
        flip_vertical(mp1, newmp);
        if (isSame(newmp, mp2)) {
          flag = true;
        }
      }
      if (!flag) {
        for (int i = 0; i < 3; ++i) {
          rotate(mp1, newmp);
          mp1.swap(newmp);
          if (isSame(mp1, mp2)) {
            flag = true;
          } else {
            flip_horizontal(mp1, newmp);
            if (isSame(newmp, mp2)) {
              flag = true;
            } else {
              flip_vertical(mp1, newmp);
              if (isSame(newmp, mp2)) {
                flag = true;
              }
            }
          }
        }
      }
    }
    if (flag) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
