#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  char a[15][15];
  char b[15][15];
  char c[15][15];
  char d[15][15];
  while (cin >> n) {
    bool ok1 = false, ok2 = true;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int k = 0; k < 4; k++) {
      if (k == 0) {
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) c[i][j] = a[i][j];
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        for (int i = 0; i < n / 2; i++)
          for (int j = 0; j < n; j++) swap(c[i][j], c[n - 1 - i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) d[i][j] = a[i][j];
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n / 2; j++) swap(d[i][n - j - 1], d[i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (d[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
      } else if (k == 1) {
        int x = 0, y = 0;
        for (int j = 0; j < n; j++)
          for (int i = n - 1; i >= 0; i--) {
            c[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        for (int i = 0; i < n / 2; i++)
          for (int j = 0; j < n; j++) swap(c[i][j], c[n - 1 - i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        x = y = 0;
        for (int j = 0; j < n; j++)
          for (int i = n - 1; i >= 0; i--) {
            d[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n / 2; j++) swap(d[i][n - j - 1], d[i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (d[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
      } else if (k == 2) {
        int x = 0, y = 0;
        for (int i = n - 1; i >= 0; i--)
          for (int j = n - 1; j >= 0; j--) {
            c[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        for (int i = 0; i < n / 2; i++)
          for (int j = 0; j < n; j++) swap(c[i][j], c[n - 1 - i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        x = y = 0;
        for (int i = n - 1; i >= 0; i--)
          for (int j = n - 1; j >= 0; j--) {
            d[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n / 2; j++) swap(d[i][n - j - 1], d[i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (d[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
      } else {
        int x = 0, y = 0;
        for (int j = n - 1; j >= 0; j--)
          for (int i = 0; i < n; i++) {
            c[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        for (int i = 0; i < n / 2; i++)
          for (int j = 0; j < n; j++) swap(c[i][j], c[n - 1 - i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (c[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
        x = y = 0;
        for (int j = n - 1; j >= 0; j--)
          for (int i = 0; i < n; i++) {
            d[x][y++] = a[i][j];
            if (y == n) {
              x++;
              y = 0;
            }
          }
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n / 2; j++) swap(d[i][n - j - 1], d[i][j]);
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++) {
            if (d[i][j] != b[i][j]) {
              ok2 = false;
              break;
            }
          }
        if (ok2) ok1 = true;
        ok2 = true;
      }
    }
    if (ok1)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
