#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() using namespace std; typedef long long LL; typedef vector VI; int main() { string s; cin >> s; int w, e; e = (int)s.find("OOO"); w = (int)s.find("XXX"); if (w == e) { cout << "NA" << endl; return 0; } if (w == -1) { cout << "East" << endl; } else if (e == -1){ cout << "West" << endl; } else { cout << ((w > e) ? "East" : "West") << endl; } return 0; }