s=gets
a=s.index 'XXX'
b=s.index 'OOO'
if !a and !b
    puts :NA
elsif a and b
    puts a<b ? "West" : "East"
else
    puts a ? "West" : "East"
end