#include "bits/stdc++.h" using namespace std; int main() { string S; int E = 0, W = 0; cin >> S; for (int i = 0; i < S.size(); i++) { if (S[i] == 'O') E++, W = 0; else W++, E = 0; if (E == 3 || W == 3) break; } if (E == 3) cout << "East"; else if (W == 3) cout << "West"; else cout << "NA"; cout << endl; }