import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int east = 200; int west = 200; for(int i = 0; i < s.length() - 2; i++) { if((s.charAt(i) == 'O') && (s.charAt(i + 1) == 'O') && (s.charAt(i + 2) == 'O') && (east == 200)) east = i; if((s.charAt(i) == 'X') && (s.charAt(i + 1) == 'X') && (s.charAt(i + 2) == 'X') && (west == 200)) west = i; } String ans = "NA"; if(east > west) ans = "West"; if(east < west) ans = "East"; System.out.println(ans); } }