#include #include #include #include #include #include #include #include #include using namespace std; #define INIT cin.tie(0); ios::sync_with_stdio(false); #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) int main() { INIT; string s; cin >> s; int f = 2; if(s.size() >= 3){ REP(i, s.size() - 2){ if(s[i] == 'O' and s[i + 1] == 'O' and s[i + 2] == 'O'){ f = 0; break; }else if(s[i] == 'X' and s[i + 1] == 'X' and s[i + 2] == 'X'){ f = 1; break; } } } if(f == 0) cout << "East" << endl; else if(f == 1) cout << "West" << endl; else cout << "NA" << endl; return 0; }