import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); if (a.length() < 3) { System.out.println("NA"); return; } char[] ca = a.toCharArray(); for (int i = 2; i < ca.length; i++) { if (ca[i] == ca[i - 1] && ca[i - 1] == ca[i - 2] && ca[i] == ca[i - 2]) { if (ca[i] == 'O') { System.out.println("East"); break; } else if (ca[i] == 'X') { System.out.println("West"); break; } else { System.out.println("へんだよ!"); break; } } else { System.out.println("NA"); break; } } } }