#include <bits/stdc++.h>
using namespace std;
vector<string> flipX(vector<string> A) {
  int n = A.size();
  for (int i = 0; i < n / 2; i++) {
    swap(A[i], A[n - 1 - i]);
  }
  return A;
}
vector<string> flipY(vector<string> A) {
  int n = A.size();
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i < n / 2; i++) {
      swap(A[j][i], A[j][n - 1 - i]);
    }
  }
  return A;
}
vector<string> rotate(vector<string> A) {
  vector<string> B(A);
  int n = A.size();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      B[j][n - 1 - i] = A[i][j];
    }
  }
  return B;
}
bool areEqual(vector<string> A, vector<string> B) {
  int n = A.size();
  for (int i = 0; i < n; ++i) {
    if (A[i] != B[i]) return false;
  }
  return true;
}
void printMatrix(vector<string> A) {
  int n = A.size();
  for (int i = 0; i < n; ++i) {
    cout << A[i] << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  bool poss = false;
  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];
  }
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  B = flipX(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  B = flipY(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  B = flipX(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  poss = poss || areEqual(A, B);
  B = rotate(B);
  if (poss)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
