import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000486_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String s = br.readLine(); int oi = s.indexOf("OOO"); int xi = s.indexOf("XXX"); if(oi == -1 && xi == -1) { System.out.println("NA"); } else { if(oi == -1 || xi < oi) { System.out.println("West"); } else { System.out.println("East"); } } } }