#include using namespace std; int main() { string S; cin >> S; int e = (int)S.find("OOO"), w = (int)S.find("XXX"); cout << ((e == -1 && w == -1) ? "NA" : (e < w && e != -1) ? "East" : "West") << "\n"; }