import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); int cnt1 = 0; int cnt2 = 0; for(int i = 0; i < S.length(); i++) { char c = S.charAt(i); if(c == 'O') { cnt1 ++; cnt2 = 0; }else { cnt1 = 0; cnt2 ++; } if(cnt1 == 3) { System.out.println("EAST"); System.exit(0); }else if(cnt2 == 3) { System.out.println("WEST"); System.exit(0); } } System.out.println("NA"); } }