#include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream using namespace std; int main() { string S; cin >> S; int e = 0, w = 0; int ans = -1; int flg = -1; for (unsigned int i = 0; i < S.length(); i++) { if (S[i] == 'O') { e++; if (flg == 1) { if (e == 3) { ans = 1; break; } } else { flg = 1; w = 0; } } if (S[i] == 'X') { w++; if (flg == 0) { if (w == 3) { ans = 0; break; } } else { flg = 0; e = 0; } } } switch (ans) { case 1:cout << "East" << endl; break; case 0:cout << "West" << endl; break; case -1:cout << "NA" << endl; break; } return 0; }