#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int base, long long int pow) {
  long long int res = 1;
  while (pow) {
    if (pow % 2 != 0) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    pow /= 2;
  }
  return res;
}
void rotate(char d[][10], int n) {
  int temp[10][10];
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; j++) temp[i][j] = d[i][j];
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; j++) d[j][n - 1 - i] = temp[i][j];
}
void flip(char d[][10], int n, int choice) {
  int temp[10][10];
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; j++) temp[i][j] = d[i][j];
  if (choice == 0)
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) d[i][j] = temp[i][n - 1 - j];
  else if (choice == 1) {
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) d[i][j] = temp[i][n - 1 - j];
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) temp[i][j] = d[i][j];
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) d[i][j] = temp[n - 1 - i][j];
  } else if (choice == 2) {
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) d[i][j] = temp[n - 1 - i][j];
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) temp[i][j] = d[i][j];
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++)
        d[i][j] = temp[n - 1 - i][n - 1 - j];
  }
}
char c[10][10], d[10][10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; j++) {
      cin >> c[i][j];
    }
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; j++) {
      cin >> d[i][j];
    }
  int flag = 0;
  for (long long int iter = 0; iter < 4; iter++) {
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) {
        if (c[i][j] != d[i][j]) {
          flag = 0;
          break;
        }
      }
    if (flag) {
      cout << "Yes";
      return 0;
    }
    flag = 1;
    rotate(d, n);
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) {
        if (c[i][j] != d[i][j]) {
          flag = 0;
          break;
        }
      }
    if (flag) {
      cout << "Yes";
      return 0;
    }
    flag = 1;
    rotate(d, n);
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) {
        if (c[i][j] != d[i][j]) {
          flag = 0;
          break;
        }
      }
    if (flag) {
      cout << "Yes";
      return 0;
    }
    flag = 1;
    rotate(d, n);
    for (long long int i = 0; i < n; i++)
      for (long long int j = 0; j < n; j++) {
        if (c[i][j] != d[i][j]) {
          flag = 0;
          break;
        }
      }
    if (flag) {
      cout << "Yes";
      return 0;
    }
    flag = 1;
    rotate(d, n);
    flip(d, n, (long long int)iter);
  }
  cout << "No";
}
