#include <bits/stdc++.h>
#pragma GCC optimize "trapv"
using namespace std;
const long long MOD = 1e9 + 7;
void print() { cout << "\n"; }
void printArray() { return; }
void read() { return; }
template <typename T, typename... Args>
void print(T a, Args... arg) {
  cout << a << " ";
  print(arg...);
}
template <typename T, typename... Args>
void read(T &a, Args &...arg) {
  cin >> a;
  read(arg...);
}
template <typename T, typename... Args>
void read(vector<T> &v, Args &...arg) {
  for (auto &i : v) cin >> i;
  read(arg...);
}
template <typename T, typename... Args>
void printArray(vector<T> &v, Args &...arg) {
  for (auto i : v) cout << i << " ";
  cout << "\n";
  printArray(arg...);
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1LL) res = res * a;
    b >>= 1LL;
    a = a * a;
  }
  return res;
}
long long modPower(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1L) res = (res % MOD * a % MOD) % MOD;
    b >>= 1;
    a = (a % MOD * a % MOD) % MOD;
  }
  return res;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long modInverse(long long b, long long m) {
  long long x, y;
  long long g = gcdExtended(b, m, &x, &y);
  if (g != 1) return -1;
  return (x % m + m) % m;
}
long long modDivide(long long a, long long b, long long m = MOD) {
  a = a % m;
  long long inv = modInverse(b, m);
  if (inv == -1)
    return -1;
  else
    return (inv * a) % m;
}
void rotate(vector<vector<char>> &v) {
  vector<vector<char>> vv = v;
  long long n = v.size();
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) v[i][j] = vv[j][i];
  }
}
void flip_row(vector<vector<char>> &v) {
  long long n = v.size();
  for (long long i = 0; i < n / 2; i++) {
    vector<char> t = v[n - i - 1];
    v[n - i - 1] = v[i];
    v[i] = t;
  }
}
void flip_col(vector<vector<char>> &v) {
  long long n = v.size();
  for (long long i = 0; i < n / 2; i++) {
    for (long long j = 0; j < n; j++) {
      char c = v[j][n - i - 1];
      v[j][n - i - 1] = v[j][i];
      v[j][i] = c;
    }
  }
}
bool matched(vector<vector<char>> &a, vector<vector<char>> &b) {
  long long n = a.size();
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) return false;
    }
  }
  return true;
}
void runCase_() {
  long long n;
  read(n);
  vector<vector<char>> a(n, vector<char>(n)), b(n, vector<char>(n));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) read(a[i][j]);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) read(b[i][j]);
  bool poss = 0;
  for (long long i = 0; i < 4; i++) {
    if (i > 0) rotate(b);
    for (long long j = 0; j < 2; j++) {
      if (j > 0) flip_row(b);
      for (long long k = 0; k < 2; k++) {
        if (k > 0) flip_col(b);
        if (matched(a, b)) {
          poss = 1;
          break;
        }
      }
      if (poss) break;
    }
    if (poss) break;
  }
  if (poss)
    print("yes");
  else
    print("no");
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  runCase_();
  return 0;
}
