n = gets.chomp.to_i
commands = []
n.times { commands.push(gets.chomp) }

# arr = []
# commands.each do |cmd|
#     if cmd.split(' ')[0] == "insert" then
#         arr.push(cmd.split(' ')[1]) unless arr.include?(cmd.split(' ')[1])
#     else
#         if arr.include?(cmd.split(' ')[1]) then
#             puts "yes"
#         else
#             puts "no"
#         end
#     end
# end

hs = Hash.new([])
commands.each do |command|
    # p hs
    cmd, str = command.split(' ')
    if cmd == "insert" then
        hs[str] = str
    else
        if hs[str] == str then
            puts "yes"
        else
            puts "no"
        end
    end
end



