e=0;w=0;gets.chars.each{|z|e+=1 if z=='O'; w+=1 if z=='X' if e == 3;puts "East";exit;end;if w==3;puts "West";end} puts "NA"