class Fixnum
def-@
1-self
end
alias:+:|
def>x
-self|x
end
end
T=1
F=0
until(s=gets.sub(?=,'==').gsub('->',?>))<?(
v=s.scan(/[a-z]/).uniq
puts %w(T F).repeated_permutation(v.size).all?{|a|
eval s.tr(v*'',a*'')
}?'YES':'NO'
end