#include <bits/stdc++.h>
using namespace std;
char ch[11][11], h[11][11];
int ans = 0;
int a, b, c, d, e;
void dfs(int x) {
  int y = 0;
  int v = 0, l = a - 1, p = 0;
  char k[11][11];
  for (int i = 0; i < a; i++) {
    v = 0;
    l = a - 1;
    l = l + p;
    v = v + p;
    p--;
    for (int j = 0; j < a; j++) {
      k[i][j] = ch[i + v][j + l];
      v++;
      l--;
    }
  }
  int popo = 0;
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != k[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char g[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      g[i][j] = ch[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != g[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char gh[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      gh[i][j] = g[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != gh[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char q[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    for (int j = 0; j < a; j++) {
      q[i][j] = ch[i][v];
      v--;
    }
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != q[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char w[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      w[i][j] = q[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != w[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char zx[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      zx[i][j] = w[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != zx[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char xc[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      xc[i][j] = zx[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != xc[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
  char op[11][11];
  p = 0;
  l = 0;
  for (int i = 0; i < a; i++) {
    v = a - 1;
    v = v - p;
    p++;
    for (int j = 0; j < a; j++) {
      op[i][j] = xc[i + v][l];
      v--;
    }
    l++;
  }
  popo = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (h[i][j] != op[i][j]) popo++;
    }
  }
  if (popo == 0 && ans == 0) {
    cout << "Yes" << endl;
    ans++;
  }
}
int main() {
  cin >> a;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) cin >> ch[i][j];
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) cin >> h[i][j];
  }
  int hj = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (ch[i][j] != h[i][j]) hj++;
    }
  }
  if (hj == 0) {
    cout << "Yes";
    return 0;
  }
  dfs(1);
  if (ans == 0) cout << "No";
  return 0;
}
