#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:360777216")
using LL = long long;
const int INF = 2 * 1000 * 1000 * 1000;
LL MOD = 1e9 + 7;
LL LINF = (LL)4e18;
double EPS = 1e-7;
using namespace std;
LL t, m, n, x, a, b, y, c, l, r;
LL gcd(LL a, LL b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
LL lcm(LL a, LL b) { return a * b / gcd(a, b); }
bool is_eq_maps(vector<string> &m1, vector<string> &m2) {
  bool ok = true;
  for (int(i) = 0; (i) < n; (i)++) {
    if (m1[i] != m2[i]) ok = false;
  }
  return ok;
}
vector<string> rotate_map(vector<string> &m1) {
  vector<string> res = m1;
  for (int(i) = 0; (i) < n; (i)++) {
    for (int(j) = 0; (j) < n; (j)++) {
      res[j][n - i - 1] = m1[i][j];
    }
  }
  return res;
}
vector<string> flip_map_hor(vector<string> &m1) {
  vector<string> res = m1;
  for (int(i) = 0; (i) < n; (i)++) {
    res[i] = m1[n - 1 - i];
  }
  return res;
}
vector<string> flip_map_vert(vector<string> &m1) {
  vector<string> res = rotate_map(m1);
  res = flip_map_hor(res);
  res = rotate_map(res);
  res = rotate_map(res);
  res = rotate_map(res);
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  vector<string> m1(n), m2(n);
  for (int(i) = 0; (i) < n; (i)++) cin >> m1[i];
  for (int(i) = 0; (i) < n; (i)++) cin >> m2[i];
  bool ok = false;
  for (int(i) = 0; (i) < 4; (i)++) {
    auto new_m1 = rotate_map(m1);
    for (int(j) = 0; (j) < 4; (j)++) {
      auto new_m2 = rotate_map(m2);
      if (is_eq_maps(new_m1, new_m2)) {
        ok = true;
        break;
      }
      m2 = new_m2;
    }
    if (ok) break;
    m2 = flip_map_hor(m2);
    if (is_eq_maps(new_m1, m2)) {
      ok = true;
      break;
    }
    m2 = flip_map_hor(m2);
    m2 = flip_map_vert(m2);
    if (is_eq_maps(new_m1, m2)) {
      ok = true;
      break;
    }
    m2 = flip_map_vert(m2);
    m1 = new_m1;
  }
  if (ok) {
    cout << "Yes" << endl;
    return 0;
  }
  m1 = flip_map_hor(m1);
  for (int(j) = 0; (j) < 4; (j)++) {
    auto new_m2 = rotate_map(m2);
    if (is_eq_maps(m1, new_m2)) {
      ok = true;
      break;
    }
    m2 = new_m2;
  }
  if (ok) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_hor(m2);
  if (is_eq_maps(m1, m2)) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_hor(m2);
  m2 = flip_map_vert(m2);
  if (is_eq_maps(m1, m2)) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_vert(m2);
  m1 = flip_map_hor(m1);
  m1 = flip_map_vert(m1);
  for (int(j) = 0; (j) < 4; (j)++) {
    auto new_m2 = rotate_map(m2);
    if (is_eq_maps(m1, new_m2)) {
      ok = true;
      break;
    }
    m2 = new_m2;
  }
  if (ok) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_hor(m2);
  if (is_eq_maps(m1, m2)) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_hor(m2);
  m2 = flip_map_vert(m2);
  if (is_eq_maps(m1, m2)) {
    cout << "Yes" << endl;
    return 0;
  }
  m2 = flip_map_vert(m2);
  m1 = flip_map_vert(m1);
  cout << "No" << endl;
  return 0;
}
