#include <bits/stdc++.h>
using namespace std;
int n;
char a[15][15], b[15][15], c[15][15];
void change90() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      b[i][j] = c[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      c[n - 1 - j][i] = b[i][j];
    }
  }
}
void changeupdown() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      b[i][j] = c[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      c[n - 1 - i][j] = b[i][j];
    }
  }
}
void changerightleft() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      b[i][j] = c[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      c[i][n - 1 - j] = b[i][j];
    }
  }
}
bool check() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i][j] != c[i][j]) return 0;
    }
  }
  return 1;
}
int main() {
  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 >> c[i][j];
    }
  }
  if (check()) {
    cout << "Yes" << endl;
    return 0;
  }
  changeupdown();
  if (check()) {
    cout << "Yes" << endl;
    return 0;
  }
  changeupdown();
  changerightleft();
  if (check()) {
    cout << "Yes" << endl;
    return 0;
  }
  changerightleft();
  for (int i = 0; i < 3; i++) {
    change90();
    if (check()) {
      cout << "Yes" << endl;
      return 0;
    }
    changeupdown();
    if (check()) {
      cout << "Yes" << endl;
      return 0;
    }
    changeupdown();
    changerightleft();
    if (check()) {
      cout << "Yes" << endl;
      return 0;
    }
    changerightleft();
  }
  cout << "No" << endl;
  return 0;
}
