#include <bits/stdc++.h>
using namespace std;
char s1[12][12], s2[12][12];
int solve(int n) {
  int i1 = 0, j1 = 0, i2 = n - 1, j2 = 0, i3 = n - 1, j3 = 0, i4 = n - 1,
      j4 = n - 1, i5 = n - 1, j5 = n - 1, i6 = 0, j6 = n - 1, i8 = 0,
      j8 = n - 1, c1 = 1, c2 = 1, c3 = 1, c4 = 1, c5 = 1, c6 = 1, c7 = 1,
      c8 = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (c7) {
        if (s1[i][j] != s2[i][j]) c7 = 0;
      }
      if (c8) {
        if (s1[i][j] == s2[i8][j8]) {
          j8--;
        } else
          c8 = 0;
      }
      if (c1) {
        if (s1[i][j] == s2[i1][j1]) {
          i1++;
        } else
          c1 = 0;
      }
      if (c2) {
        if (s1[i][j] == s2[i2][j2]) {
          i2--;
        } else
          c2 = 0;
      }
      if (c3) {
        if (s1[i][j] == s2[i3][j3]) {
          j3++;
        } else
          c3 = 0;
      }
      if (c4) {
        if (s1[i][j] == s2[i4][j4]) {
          j4--;
        } else
          c4 = 0;
      }
      if (c5) {
        if (s1[i][j] == s2[i5][j5]) {
          i5--;
        } else
          c5 = 0;
      }
      if (c6) {
        if (s1[i][j] == s2[i6][j6]) {
          i6++;
        } else
          c6 = 0;
      }
    }
    i1 = 0;
    j1++;
    i2 = n - 1;
    j2++;
    j3 = 0;
    i3--;
    i4--;
    j4 = n - 1;
    i5 = n - 1;
    j5--;
    i6 = 0;
    j6--;
    j8 = n - 1;
    i8++;
  }
  return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s1[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", s2[i]);
  }
  if (solve(n)) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
