#include #include int main(){ int i, len, cnt_O = 0, cnt_X = 0, state; char str[101]; scanf("%s", str); len = strlen(str); if(str[0] == 'O'){ state = 0; cnt_O++; }else{ state = 1; cnt_X++; } for(i = 1; i < len; i++){ if(state == 0){ if(str[i] == 'O'){ cnt_O++; }else{ cnt_O = 0; cnt_X++; state = 1; continue; } } if(state == 1){ if(str[i] == 'X'){ cnt_X++; }else{ cnt_X = 0; cnt_O++; state = 0; continue; } } if(cnt_O == 3){ state = 2; break; } if(cnt_X == 3){ state = 3; break; } } if(state == 2){ printf("East\n"); }else if(state == 3){ printf("West\n"); }else{ printf("NA\n"); } return 0; }