import java.io.*;
public class Main {
final static String dirs
= "NSEW";
int n = in.nextInt() - 1;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; ++i) {
sb.append(dirs.charAt(dirs.indexOf(s1.charAt(n - i - 1)) ^ 1));
}
sb.append(s2);
int[] p = new int[2 * n];
for (int i = 1; i < 2 * n; ++i) {
p[i] = p[i - 1];
while (p[i] != 0 && sb.charAt(i) != sb.charAt(p[i])) {
p[i] = p[p[i] - 1];
}
if (sb.charAt(i) == sb.charAt(p[i])) {
p[i]++;
}
}
out.println(p[2 * n - 1] == 0 ? "YES" : "NO");
}
out.close();
}
static class Input {
StringBuilder sb = new StringBuilder();
this.in = in;
}
}
sb.setLength(0);
while (true) {
int c = in.read();
if (c == -1) {
return null;
}
if (" \n\r\t".indexOf(c) == -1) {
sb.append((char)c);
break;
}
}
while (true) {
int c = in.read();
if (c == -1 || " \n\r\t".indexOf(c) != -1) {
break;
}
sb.append((char)c);
}
return sb.toString();
}
}
return Long.
parseLong(next
()); }
return Double.
parseDouble(next
()); }
}
}
aW1wb3J0IGphdmEuaW8uKjsKCnB1YmxpYyBjbGFzcyBNYWluIHsKICAgIGZpbmFsIHN0YXRpYyBTdHJpbmcgZGlycyA9ICJOU0VXIjsKCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgc29sdmUoSW5wdXQgaW4sIFByaW50V3JpdGVyIG91dCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKICAgICAgICBpbnQgbiA9IGluLm5leHRJbnQoKSAtIDE7CiAgICAgICAgU3RyaW5nIHMxID0gaW4ubmV4dCgpOwogICAgICAgIFN0cmluZyBzMiA9IGluLm5leHQoKTsKICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgICAgICBzYi5hcHBlbmQoZGlycy5jaGFyQXQoZGlycy5pbmRleE9mKHMxLmNoYXJBdChuIC0gaSAtIDEpKSBeIDEpKTsKICAgICAgICB9CiAgICAgICAgc2IuYXBwZW5kKHMyKTsKICAgICAgICBpbnRbXSBwID0gbmV3IGludFsyICogbl07CiAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCAyICogbjsgKytpKSB7CiAgICAgICAgICAgIHBbaV0gPSBwW2kgLSAxXTsKICAgICAgICAgICAgd2hpbGUgKHBbaV0gIT0gMCAmJiBzYi5jaGFyQXQoaSkgIT0gc2IuY2hhckF0KHBbaV0pKSB7CiAgICAgICAgICAgICAgICBwW2ldID0gcFtwW2ldIC0gMV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHNiLmNoYXJBdChpKSA9PSBzYi5jaGFyQXQocFtpXSkpIHsKICAgICAgICAgICAgICAgIHBbaV0rKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBvdXQucHJpbnRsbihwWzIgKiBuIC0gMV0gPT0gMCA/ICJZRVMiIDogIk5PIik7CiAgICB9CgogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIElPRXhjZXB0aW9uIHsKICAgICAgICBQcmludFdyaXRlciBvdXQgPSBuZXcgUHJpbnRXcml0ZXIoU3lzdGVtLm91dCk7CiAgICAgICAgc29sdmUobmV3IElucHV0KG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoU3lzdGVtLmluKSkpLCBvdXQpOwogICAgICAgIG91dC5jbG9zZSgpOwogICAgfQoKICAgIHN0YXRpYyBjbGFzcyBJbnB1dCB7CiAgICAgICAgQnVmZmVyZWRSZWFkZXIgaW47CiAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CgogICAgICAgIHB1YmxpYyBJbnB1dChCdWZmZXJlZFJlYWRlciBpbikgewogICAgICAgICAgICB0aGlzLmluID0gaW47CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgSW5wdXQoU3RyaW5nIHMpIHsKICAgICAgICAgICAgdGhpcy5pbiA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKHMpKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBTdHJpbmcgbmV4dCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CiAgICAgICAgICAgIHNiLnNldExlbmd0aCgwKTsKICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgICAgICAgIGludCBjID0gaW4ucmVhZCgpOwogICAgICAgICAgICAgICAgaWYgKGMgPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgiIFxuXHJcdCIuaW5kZXhPZihjKSA9PSAtMSkgewogICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgoY2hhciljKTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICB3aGlsZSAodHJ1ZSkgewogICAgICAgICAgICAgICAgaW50IGMgPSBpbi5yZWFkKCk7CiAgICAgICAgICAgICAgICBpZiAoYyA9PSAtMSB8fCAiIFxuXHJcdCIuaW5kZXhPZihjKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc2IuYXBwZW5kKChjaGFyKWMpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBzYi50b1N0cmluZygpOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIGludCBuZXh0SW50KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKICAgICAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQobmV4dCgpKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBsb25nIG5leHRMb25nKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKICAgICAgICAgICAgcmV0dXJuIExvbmcucGFyc2VMb25nKG5leHQoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgZG91YmxlIG5leHREb3VibGUoKSB0aHJvd3MgSU9FeGNlcHRpb24gewogICAgICAgICAgICByZXR1cm4gRG91YmxlLnBhcnNlRG91YmxlKG5leHQoKSk7CiAgICAgICAgfQogICAgfQp9Cg==