#include using namespace std; #define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++) #define ALL(x) x.begin(),x.end() template bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; } template bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; } typedef long long ll; int N; string S; int main() { cin >> S; N = S.size(); FOR(i,2,N){ if(S [i] == 'O' && S [i - 1] == 'O' && S [i - 2] == 'O'){ cout << "East" << endl; return 0; } else if(S [i] == 'X' && S [i - 1] == 'X' && S [i - 2] == 'X'){ cout << "West" << endl; return 0; } } cout << "NA" << endl; return 0; }