import java.util.*; public class No_486{ public static void main(String[] args){ String Str; int West=0,East=0; Scanner scanner = new Scanner(System.in); scanner.close(); Str = scanner.next(); for(int i=0;i=3){ System.out.println("East"); return;} } if(Str.charAt(i)=='X'){ West=0; East++; if(East>=3){ System.out.println("West"); return;} } } System.out.println("NA"); } }