loop do
    exp = gets.chomp
    break if exp == ?#
    ok = false
    exp.split(?|).each do |term|
        vars = term[1..-2].split(?&)
        if vars.permutation(2).any?{|v1, v2| v1 == ?~ + v2}
            next
        end
        ok = true
        break
    end
    puts ok ? 'yes' : 'no'
end