#include <bits/stdc++.h>
using namespace std;
int n;
string st[2][11];
bool f;
void pere(void) {
  string t[11];
  for (int i = 0; i < n; ++i) {
    t[i] = st[1][i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      t[i][j] = st[1][n - j - 1][i];
    }
  }
  for (int i = 0; i < n; ++i) {
    st[1][i] = t[i];
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> st[0][i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> st[1][i];
  }
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][i]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][n - i - 1]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    reverse(st[1][i].begin(), st[1][i].end());
  }
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][i]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][n - i - 1]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  pere();
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][i]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][n - i - 1]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    reverse(st[1][i].begin(), st[1][i].end());
  }
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][i]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  f = false;
  for (int i = 0; i < n; ++i) {
    if (st[0][i] != st[1][n - i - 1]) {
      f = true;
      break;
    }
  }
  if (!f) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
}
