#include using namespace std; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define fore(i,a) for(auto &i:a) typedef long long ll; typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 2147483647; const ll INFL = 9223372036854775807; const ll mod = 1000000007; int main() { string s; cin >> s; bool b = true; int e = 0, w = 0; REP(i, s.size()) { if (b) { if (s[i] == 'O') { e++; if (e == 3) { cout << "East" << endl; return 0; } } else { e = 0; w = 1; b = false; } } else { if (s[i] == 'X') { w++; if (w == 3) { cout << "West" << endl; return 0; } } else { w = 0; e = 1; b = true; } } } cout << "NA" << endl; return 0; }