s = gets.chomp w, e = [s.index("OOO"), s.index("XXX")] # #index がnilを返す対策 w = w ? w : -1 e = e ? e : -1 puts W < E ? "West" : (W > E ? "East" : "NA")