#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926536;
int const N = 1000005;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void TXT() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  FAST();
  int n;
  cin >> n;
  char a[n][n], b[n][n];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> b[i][j];
  int f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[j][i]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[n - i - 1][j]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][n - j - 1]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[n - i - 1][n - j - 1]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[n - j - 1][n - i - 1]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[n - j - 1][i]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  }
  f = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[j][n - i - 1]) f = 1;
    }
  if (f == 0) {
    cout << "Yes";
    return (0);
    ;
  } else
    cout << "No";
}
