s=gets
a=s.index("XXX")
b=s.index("OOO")
a=10**9 if !a
b=10**9 if !b
puts a<b ? :West : a>b ? :East : :NA