S = str(input().rstrip()) l = S.find("XXX") w = S.find("OOO") if l == w == -1: print("NA") elif l < w: print("West") else: print("East")