#include using namespace std; int main(){ string s; cin >> s; int win=0,lose=0; for(int i=0; i < s.size(); i++){ if(s[i] == 'O') {win++; lose=0;} else {lose++; win=0;} if(win == 3 || lose == 3){ cout << (win == 3 ? "East" : "West") << endl; return 0; } } cout << "NA" << endl; }