import numpy as np s = input() E,W = s.find("OOO")%101, s.find("XXX")%101 print(("East","NA","West")[np.sign(E-W)+1])