#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<string>
typedef long long ll;
ll a,b,ans;
char WS[110];
int W=0,S=0,win;
 int main(){
     scanf("%s",&WS);
     int i=0;
     while(WS[i]!='\0'){
         if(WS[i]=='O'){
             S=0;
             W++;
         }
         else{
             W=0;
             S++;
         }
         if(W==3){
             printf("East");
             return 0;
         }
         if(S==3){
             printf("West");
             return 0;
         }
         i++;
     }
     printf("NA");
     return 0;

 }