s=gets.chomp n=s.size cnte = 0 cntw = 0 n.times do |i| if s[i] == 'O' cnte += 1 cntw = 0 else cntw += 1 cnte = 0 end if cnte == 3 puts "East" exit elsif cntw == 3 puts "West" exit end end puts "NA"