s = gets.chomp W, E = [s.index("OOO"), s.index("XXX")] puts W < E ? "West" : (W > E ? "East" : "NA")