#include <bits/stdc++.h>
using namespace std;
int n;
char a[11][11], b[11][11], tmp[11][11];
bool flipx() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      tmp[n - i - 1][j] = a[i][j];
    }
  }
  bool res = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (tmp[i][j] != b[i][j]) {
        res = false;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = tmp[i][j];
  return res;
}
bool flipy() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      tmp[i][n - j - 1] = a[i][j];
    }
  }
  bool res = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (tmp[i][j] != b[i][j]) {
        res = false;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = tmp[i][j];
  return res;
}
bool r1() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      tmp[j][n - i - 1] = a[i][j];
    }
  }
  bool res = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (tmp[i][j] != b[i][j]) {
        res = false;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = tmp[i][j];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  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];
  bool res;
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipx();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipx();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipy();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipy();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipx();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = flipy();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  res = r1();
  if (res == true) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}
