import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String [] s = sc.next().split(""); sc.close(); int countE = 0; int countW = 0; String result = ""; for ( int i = 0; i < s.length; i++ ){ if ( s[i].equals("O")){ countE++; countW = 0; } else if ( s[i].equals("X")){ countW++; countE = 0; } if( countE == 3 ) { result = "East"; break; } else if( countW == 3){ result = "West"; break; } else {System.out.println("NA");} } System.out.println(result); } }