import java.io.*; import java.util.*; public class Main_yukicoder486 { private static Scanner sc; private static Printer pr; private static void solve() { char[] s = sc.next().toCharArray(); int east = 0; int west = 0; for (char c : s) { if (c == 'O') { east++; west = 0; } else { west++; east = 0; } if (west >= 3) { pr.println("West"); return; } else if (east >= 3) { pr.println("East"); return; } } pr.println("NA"); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }