#include <bits/stdc++.h>
const long double eps = 0.00000001;
const long long MOD = 1e9 + 7;
using namespace std;
int ans;
string second[20], need[20], news[20];
int main() {
  fflush(stdin);
  cout << fixed, cout.precision(18);
  ios_base::sync_with_stdio(false);
  int i, j, n, m;
  cin >> n;
  for (i = 0; i < n; ++i) cin >> second[i];
  for (i = 0; i < n; ++i) cin >> need[i];
  bool fl = true;
  for (i = 0; i < n; ++i)
    if (second[i] != need[i]) fl = false;
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    if (second[i] != need[n - i - 1]) fl = false;
  }
  if (fl) return cout << "Yes", 0;
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) news[i] += need[j][i];
  fl = true;
  for (i = 0; i < n; ++i) {
    if (second[i] != news[i]) fl = false;
  }
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    if (second[i] != news[n - i - 1]) fl = false;
  }
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    reverse(need[i].begin(), need[i].end());
    if (second[i] != need[i]) fl = false;
    reverse(need[i].begin(), need[i].end());
  }
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    reverse(need[n - i - 1].begin(), need[n - i - 1].end());
    if (second[i] != need[n - i - 1]) fl = false;
    reverse(need[n - i - 1].begin(), need[n - i - 1].end());
  }
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    reverse(news[i].begin(), news[i].end());
    if (second[i] != news[i]) fl = false;
    reverse(news[i].begin(), news[i].end());
  }
  if (fl) return cout << "Yes", 0;
  fl = true;
  for (i = 0; i < n; ++i) {
    reverse(news[n - i - 1].begin(), news[n - i - 1].end());
    if (second[i] != news[n - i - 1]) fl = false;
    reverse(news[n - i - 1].begin(), news[n - i - 1].end());
  }
  if (fl) return cout << "Yes", 0;
  cout << "No";
}
