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