#include #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; const int INF = 2000000000; using namespace std; int main(){ string s; cin >> s; if(s.size() <= 2){ cout << "NA" << endl; return 0; } rep(i,s.size() - 2){ if(s.substr(i,3) == "OOO"){ cout << "East" << endl; return 0; }else if(s.substr(i,3) == "XXX"){ cout << "West" << endl; return 0; } } cout << "NA" << endl; return 0; }