battles = input() w = battles.find("OOO") l = battles.find("XXX") if w < l: print("East") elif w > l: print("West") else:print("NA")