#include <bits/stdc++.h>
using namespace std;
void change(char a[10][10], char b[10][10], int n);
int compare(char a[10][10], char b[10][10], int n);
void fan(char a[10][10], char b[10][10], int n);
int main() {
  int n;
  char a[10][10], b[10][10], c[10][10];
  cin >> 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];
  if (compare(a, b, n))
    cout << "Yes";
  else {
    change(a, c, n);
    if (compare(c, b, n))
      cout << "Yes";
    else {
      change(c, a, n);
      if (compare(a, b, n))
        cout << "Yes";
      else {
        change(a, c, n);
        if (compare(c, b, n))
          cout << "Yes";
        else {
          change(c, a, n);
          fan(a, c, n);
          if (compare(c, b, n))
            cout << "Yes";
          else {
            change(c, a, n);
            if (compare(a, b, n))
              cout << "Yes";
            else {
              change(a, c, n);
              if (compare(c, b, n))
                cout << "Yes";
              else {
                change(c, a, n);
                if (compare(a, b, n))
                  cout << "Yes";
                else
                  cout << "No";
              }
            }
          }
        }
      }
    }
  }
  return 0;
}
void change(char a[10][10], char b[10][10], int n) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) b[n - j - 1][i] = a[i][j];
}
int compare(char a[10][10], char b[10][10], int n) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] != b[i][j]) return 0;
      if (i == n - 1 && j == n - 1) return 1;
    }
}
void fan(char a[10][10], char b[10][10], int n) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) b[i][j] = a[i][n - 1 - j];
}
