def add word
	val = hashFunc word
    val = (val + 1) % @dic.length while @dic[val]
    @dic[val] = word
end

def hashFunc word
	word.gsub!("A", "1")
	word.gsub!("C", "2")
	word.gsub!("G", "3")
	word.gsub!("T", "4")
    val = word.to_i % @dic.length
end

def find word
	val = hashFunc word
	while true
        return true if @dic[val] == word
        return false unless @dic[val]
        val = (val + 1) % @dic.length
    end
end

@dic = Array.new(2_000_000)

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