#include using namespace std; int now = 0, straight = 0, type = 0, winner[101] = {}; char s[101]; bool win = false; int main(){ cin >> s; while (s[now] != 0){ if (s[now] == 'O'){ winner[now] = 1; } if (s[now] == 'X'){ winner[now] = 2; } now++; } now = 0; while (winner[now] != 0){ if (type == winner[now]){ straight++; if (straight == 3){ win = true; break; } } else{ straight = 1; type = winner[now]; } now++; } if (win){ if (type == 1){ cout << "East"; } else{ cout << "West"; } } else{ cout << "NA"; } return 0; }