#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000000 + 10;
int n, fail[maxn];
char s[maxn];
inline void Get_Fail() {
  int i = 0, j = -1, len = n;
  fail[0] = -1;
  while (i != len) {
    if (j == -1 || s[i] == s[j])
      fail[++i] = ++j;
    else
      j = fail[j];
  }
}
int main() {
  scanf("%d", &n);
  n -= 2;
  s[n] = getchar();
  while (s[n] < 'A' || s[n] > 'Z') s[n] = getchar();
  for (int i = n - 1; i >= 0; i--) s[i] = getchar();
  for (int i = 0; i <= n; i++)
    if (s[i] == 'N')
      s[i] = 'S';
    else if (s[i] == 'S')
      s[i] = 'N';
    else if (s[i] == 'E')
      s[i] = 'W';
    else if (s[i] == 'W')
      s[i] = 'E';
  s[n + 1] = ' ';
  scanf("%s", s + n + 2);
  n = strlen(s);
  Get_Fail();
  if (fail[n])
    puts("NO");
  else
    puts("YES");
  return 0;
}
