S = raw_input() east, west = 0, 0 for c in S: if c == 'O': east, west = east+1, 0 if east >= 3: print "East" exit(0) else: east, west = 0, west+1 if west >= 3: print "West" exit(0) print "NA"