#include <bits/stdc++.h>
using namespace std;
char grid[15][15], prime[15][15], tem[15][15];
bool match(int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (prime[i][j] != grid[i][j]) return false;
    }
  }
  return true;
}
bool hmatch(int n) {
  for (int i = 0, k = n - 1; i < n; i++, k--) {
    for (int j = 0; j < n; j++) {
      if (prime[i][j] != grid[k][j]) return false;
    }
  }
  return true;
}
bool vmatch(int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0, k = n - 1; j < n; j++, k--) {
      if (prime[i][j] != grid[i][k]) return false;
    }
  }
  return true;
}
void rotate(int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      tem[i][j] = grid[i][j];
    }
  }
  for (int i = 0, k = 0; i < n; i++, k++) {
    for (int j = n - 1, l = 0; j >= 0; j--, l++) {
      grid[k][l] = tem[j][i];
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> prime[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> grid[i];
  }
  if (match(n) || vmatch(n) || hmatch(n)) {
    cout << "Yes\n";
    return 0;
  }
  rotate(n);
  if (match(n) || vmatch(n) || hmatch(n)) {
    cout << "Yes\n";
    return 0;
  }
  rotate(n);
  if (match(n) || vmatch(n) || hmatch(n)) {
    cout << "Yes\n";
    return 0;
  }
  rotate(n);
  if (match(n) || vmatch(n) || hmatch(n)) {
    cout << "Yes\n";
    return 0;
  }
  cout << "No\n";
  return 0;
}
