#include using namespace std; #define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define FORR(i,l,n) for(int (i)=l;(i)<(int)(n);++(i)) void solve() { std::string S; cin >> S; int east = S.find("OOO"); int west = S.find("XXX"); if (east == string::npos && west == string::npos) { std::cout << "NA" << std::endl; } else if (string::npos != east && east < west || west == string::npos) { std::cout << "East" << std::endl; } else if (string::npos != west && west < east || east == string::npos) { std::cout << "West" << std::endl; } } int main() { ios::sync_with_stdio(false); solve(); return 0; }