import java.util.Scanner; public class Yukicoder486 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int e = 0, w = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'O') { e++; w = 0; } else { w++; e = 0; } if (e == 3) { System.out.println("East"); return; } else if (w == 3) { System.out.println("West"); return; } } System.out.println("NA"); } }