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

def hashF word
	word.gsub!("A", "1")
	word.gsub!("C", "2")
	word.gsub!("G", "3")
	word.gsub!("T", "4")
	return word.to_i(5) % (@dic.length + 1)
end

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


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