#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000100;
int N;
char S[MAXN], T[MAXN];
int fail[MAXN];
char op(char ch) {
  if (ch == 'N') return 'S';
  if (ch == 'S') return 'N';
  if (ch == 'E') return 'W';
  return 'E';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  N--;
  for (int i = 0; i < N; i++) {
    char ch;
    cin >> ch;
    T[N - 1 - i] = op(ch);
  }
  for (int i = 0; i < N; i++) cin >> S[i];
  fail[0] = -1;
  for (int i = 1; i < N; i++) {
    int cloc = fail[i - 1];
    while (cloc >= 0 && T[i - 1] != T[cloc]) {
      cloc = fail[cloc];
    }
    fail[i] = cloc + 1;
  }
  int tloc = 0;
  for (int i = 0; i < N; i++) {
    while (tloc >= 0 && S[i] != T[tloc]) tloc = fail[tloc];
    tloc++;
  }
  if (tloc)
    cout << "NO\n";
  else
    cout << "YES\n";
  return 0;
}
