ec, wc = 0, 0 A = input() ans = "NA" for i in range(len(A)): if 'O' == A[i]: ec += 1 wc = 0 if ec == 3: ans = ("East") break elif "X" == A[i]: wc += 1 ec = 0 if wc == 3: ans = ("West") break print(ans)