#include <bits/stdc++.h>
using namespace std;
long long MAX = 9223372036854775800;
long int mod = 1000000007;
char **a, **b, **temp;
int n;
bool compare() {
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] != temp[i][j]) break;
    }
    if (j != n) break;
  }
  if (i == n) {
    return true;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] != temp[j][n - 1 - i]) break;
    }
    if (j != n) break;
  }
  if (i == n) {
    return true;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] != temp[n - 1 - i][n - 1 - j]) break;
    }
    if (j != n) break;
  }
  if (i == n) {
    return true;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] != temp[n - 1 - j][i]) break;
    }
    if (j != n) break;
  }
  if (i == n) {
    return true;
  }
  return false;
}
int main() {
  cin >> n;
  a = new char *[n];
  temp = new char *[n];
  b = new char *[n];
  for (int i = 0; i < n; i++) {
    a[i] = new char[n];
    b[i] = new char[n];
    temp[i] = new char[n];
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", b[i]);
    for (int j = 0; j < n; j++) temp[i][j] = b[i][j];
  }
  if (compare()) {
    cout << "Yes";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      temp[i][j] = b[i][n - 1 - j];
    }
  }
  if (compare()) {
    cout << "Yes";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      temp[i][j] = b[n - 1 - i][j];
    }
  }
  if (compare()) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}
