#include #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 #define int long long using namespace std; typedef long long ll; const int INF = 1e9; signed main() { string S; cin >> S; auto east = S.find("OOO"); auto west = S.find("XXX"); if (east == string::npos && west == string::npos) { cout << "NA" << endl; } else { if (east < west) { cout << "East" << endl; } else { cout << "West" << endl; } } }