public class Main{ public static void main(String[] args){ String line = new java.util.Scanner(System.in).next(); if(line.indexOf("XXX") == -1 && line.indexOf("OOO") != -1)System.out.println("East"); else if(line.indexOf("XXX") != -1 && line.indexOf("OOO") == -1)System.out.println("West"); else if(line.indexOf("XXX") < line.indexOf("OOO"))System.out.println("West"); else if(line.indexOf("XXX") > line.indexOf("OOO"))System.out.println("East"); else System.out.println("NA"); } }