#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<pair<int, int>, vector<pair<int, int>>,
                       greater<pair<int, int>>>
    rpqpi;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<string> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  bool can = true;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] != b[i][j]) {
        can = false;
        i = n;
        j = n;
      }
    }
  }
  if (can) {
    cout << "Yes\n";
  } else {
    can = true;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (a[i][j] != b[n - j - 1][i]) {
          can = false;
          i = n;
          j = n;
        }
      }
    }
    if (can) {
      cout << "Yes\n";
    } else {
      can = true;
      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]) {
            can = false;
            i = n;
            j = n;
          }
        }
      }
      if (can) {
        cout << "Yes\n";
      } else {
        can = true;
        for (int i = 0; i < n; ++i) {
          for (int j = 0; j < n; ++j) {
            if (a[i][j] != b[j][n - i - 1]) {
              can = false;
              i = n;
              j = n;
            }
          }
        }
        if (can) {
          cout << "Yes\n";
        } else {
          can = true;
          for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
              if (a[i][j] != b[i][n - j - 1]) {
                can = false;
                i = n;
                j = n;
              }
            }
          }
          if (can) {
            cout << "Yes\n";
          } else {
            can = true;
            for (int i = 0; i < n; ++i) {
              for (int j = 0; j < n; ++j) {
                if (a[i][j] != b[j][i]) {
                  can = false;
                  i = n;
                  j = n;
                }
              }
            }
            if (can) {
              cout << "Yes\n";
            } else {
              can = true;
              for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                  if (a[i][j] != b[n - i - 1][j]) {
                    can = false;
                    i = n;
                    j = n;
                  }
                }
              }
              if (can) {
                cout << "Yes\n";
              } else {
                can = true;
                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]) {
                      can = false;
                      i = n;
                      j = n;
                    }
                  }
                }
                if (can) {
                  cout << "Yes\n";
                } else {
                  cout << "No\n";
                }
              }
            }
          }
        }
      }
    }
  }
  return 0;
}
