#include <bits/stdc++.h>
int row1[10 + 5], col1[10 + 5];
int row2[10 + 5], col2[10 + 5];
bool judge(int *r1, int *c1, int *r2, int *c2, int n) {
  bool r = true, c = true;
  for (int i = 0; i < n; i++) {
    if (r1[i] != r2[i]) r = false;
  }
  if (!r) {
    r = true;
    for (int i = 0; i < n; i++) {
      if (r1[i] != r2[n - 1 - i]) r = false;
    }
  }
  for (int i = 0; i < n; i++) {
    if (c1[i] != c2[i]) c = false;
  }
  if (!c) {
    c = true;
    for (int i = 0; i < n; i++) {
      if (c1[i] != c2[n - 1 - i]) c = false;
    }
  }
  return (r && c);
}
int main() {
  for (int i = 0; i < 10 + 5; i++) {
    row1[i] = col1[i] = row2[i] = col2[2] = 0;
  }
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      std::cin >> c;
      if (c == 'X') {
        row1[i] = row1[i] + 1;
        col1[j] = col1[j] + 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      std::cin >> c;
      if (c == 'X') {
        row2[i] = row2[i] + 1;
        col2[j] = col2[j] + 1;
      }
    }
  }
  if (judge(row1, col1, row2, col2, n) || judge(row1, col1, col2, row2, n)) {
    std::cout << "Yes";
  } else {
    std::cout << "No";
  }
  return 0;
}
