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(/\w/).uniq
puts %w(T F).repeated_permutation(v.size).all?{|a|
eval s.tr v*'',a*''
}?'YES':'NO'
end