#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string S; cin >> S; int east = 0, west = 0; for (auto s : S) { if (s == 'O') { east++; west = 0; } if (s == 'X') { west++; east = 0; } if (east == 3 || west == 3) break; } if (west == 3) { cout << "West" << '\n'; } else if (east == 3) { cout << "East" << '\n'; } else { cout << "NA" << '\n'; } return 0; }