#include <bits/stdc++.h>
using namespace std;
int n;
int map1[10][10];
int map2[10][10];
bool checker() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (map1[i][j] != map2[i][j]) return false;
  return true;
}
void rotater() {
  int mc[10][10];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 10; j++) mc[i][j] = map1[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) map1[n - 1 - j][i] = mc[i][j];
}
void flipper() {
  int mc[10][10];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 10; j++) mc[i][j] = map1[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) map1[n - 1 - i][j] = mc[i][j];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      char a;
      cin >> a;
      map1[i][j] = (a == 'X');
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      char a;
      cin >> a;
      map2[i][j] = (a == 'X');
    }
  for (int i = 0; i < 4; i++) {
    if (checker()) {
      cout << "Yes" << endl;
      return 0;
    }
    rotater();
  }
  flipper();
  for (int i = 0; i < 4; i++) {
    if (checker()) {
      cout << "Yes" << endl;
      return 0;
    }
    rotater();
  }
  cout << "No" << endl;
  return 0;
}
