#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n;
char str2[20][20];
char str1[20][20];
char s1[20][20];
bool judge(int x, int y, int xi, int yi) {
  bool flag = true;
  for (int i = x, nx = 0; nx < n; nx++, i += xi) {
    for (int j = y, ny = 0; ny < n; ny++, j += yi) {
      if (s1[i][j] != str2[nx][ny]) {
        flag = false;
        break;
      }
    }
  }
  for (int i = y, nx = 0; nx < n; nx++, i += yi) {
    for (int j = x, ny = 0; ny < n; ny++, j += xi) {
      if (s1[i][j] != str2[nx][ny]) {
        flag |= false;
        break;
      }
    }
  }
  return flag;
}
bool judgee() {
  bool ss1 = [&]() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (s1[i][j] != str2[i][j]) return false;
      }
    }
    return true;
  }();
  auto ss2 = [&]() {
    for (int i = n - 1, nx = 0; i >= 0; i--, nx++) {
      for (int j = 0, ny = 0; j < n; j++, ny++) {
        if (s1[j][i] != str2[nx][ny]) return false;
      }
    }
    return true;
  }();
  auto ss3 = [&]() {
    for (int i = n - 1, nx = 0; i >= 0; i--, nx++) {
      for (int j = n - 1, ny = 0; j >= 0; j--, ny++) {
        if (s1[i][j] != str2[nx][ny]) return false;
      }
    }
    return true;
  }();
  auto ss4 = [&]() {
    for (int i = 0, nx = 0; i < n; i++, nx++) {
      for (int j = n - 1, ny = 0; j >= 0; j--, ny++) {
        if (s1[j][i] != str2[nx][ny]) return false;
      }
    }
    return true;
  }();
  return ss1 || ss2 || ss3 || ss4;
}
bool solve() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) s1[i][j] = str1[i][j];
  }
  bool flag = judgee();
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      s1[n - 1 - i][j] = str1[i][j];
    }
  }
  flag |= judgee();
  for (int i = n - 1; i >= 0; i--) {
    for (int j = n - 1; j >= 0; j--) {
      s1[n - 1 - i][n - 1 - j] = str1[i][j];
    }
  }
  flag |= judgee();
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j >= 0; j--) {
      s1[i][n - 1 - j] = str1[i][j];
    }
  }
  flag |= judgee();
  return flag;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> str1[i];
  for (int i = 0; i < n; i++) cin >> str2[i];
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}
