import strutils const v = high int let s = readLine stdin var e, w: int e = s.find "OOO" if e < 0: e = v w = s.find "XXX" if w < 0: w = v if e == w: echo "NA" if e < w: echo "East" if e > w: echo "West"