S = input() E = S.find("OOO") W = S.find("XXX") if E < W and E > 0: print("East") elif E > W and W > 0: print("West") else: print("NA")