#include using namespace std; int main() { string s; cin >> s; if (s.length() >= 3) { for (int i = 0; i < s.length() - 2; i++) { if (s.substr(i, 3) == "OOO") { cout << "East" << endl; return 0; } else if (s.substr(i, 3) == "XXX") { cout << "West" << endl; return 0; } cout << "NA" << endl; } } else { cout << "NA" << endl; } return 0; }