import java.util.Scanner; public class Main{ private static Scanner sc=new Scanner(System.in); public static void main(String args[])throws Exception{ String s=sc.nextLine(); if(s.indexOf("OOO")==-1 && s.indexOf("XXX")==-1) System.out.println("NA"); else if(s.indexOf("OOO")==-1) System.out.println("West"); else if(s.indexOf("XXX")==-1) System.out.println("East"); else if(s.indexOf("OOO")