def add word
    @dic[hashF(word)] = word
end

def hashF word
	word.gsub!("A", "0")
	word.gsub!("C", "1")
	word.gsub!("G", "2")
	word.gsub!("T", "3")
    return word.to_i(4)
end

def find word
    return @dic[hashF(word)]
end

@dic = Array.new(4 ** 12)

n = gets.to_i
n.times{
	command, word = gets.chomp.split
	case command
	when "insert"
		add word
	else
		puts (find word) ? "yes" : "no"
	end
}