#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.length(); for (int i = 0; i <= n - 3; i++) { string t = s.substr(i, 3); if (t == "OOO") { cout << "East" << '\n'; return 0; } else if (t == "XXX") { cout << "West" << '\n'; return 0; } } cout << "NA" << '\n'; return 0; }