def to_ruby_form(e)
    0 while e.gsub!(/([\w)])\s+([\w(])/, '\1*\2')
    e.gsub!(/\s+/, '') 
    0 while e.gsub!(/(\w)([a-z])/, '\1*\2')
    e.gsub!(?^, '**')
end

def sample(e, input)
    eval(e.tr('a-z', input))
end

N = 10

loop do
    e = gets.chomp
    break if e == ?.
    to_ruby_form(e)
    a = (0..9).to_a * 2 + (0..5).to_a
    inputs = (0..N-1).map { a.shuffle.join }
    outputs = inputs.map {|input| sample(e, input)}

    until (e = gets.chomp) == ?.    
        to_ruby_form(e)
        if (0..N-1).all? {|i| sample(e, inputs[i]) == outputs[i]}
            puts 'yes'
        else
            puts 'no'
        end
    end 
    puts ?.
end