s=gets.chomp w=0 e=0 i=0 while s.size>i c=s[i] if c=="O" then e=e+1 w=0 else w=w+1 e=0 end if e==3 then puts "East" break elsif w==3 then puts "West" break end i=i+1 end if w<3 && e<3 then puts "NA" end