#include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int e = s.find("OOO"); int w = s.find("XXX"); //cerr << "e : " << e << ", w : " << w << endl; if(e == string::npos) e = 1e9; if(w == string::npos) w = 1e9; if(e == 1e9 && w == 1e9) cout << "NA" << endl; else if(e < w) cout << "East" << endl; else cout << "West" << endl; }