import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); System.out.println(f(S)); } static String f(String S){ int x = S.indexOf("OOO"); int y = S.indexOf("XXX"); if(x==-1){ if(y==-1){ return "NA"; }else{ return "West"; } }else{ if(y==-1||x