def StrToAddress(s)
	return if s.length < 1

	bas = ""
	s.chars { |c|
		case c
		when 'A'
			bas += "0"
		when 'C'
			bas += "1"
		when 'G'
			bas += "2"
		when 'T'
			bas += "3"
		end
	}
	bas.to_i(4) + (1...s.length).inject(0) { |total, n| total + 4**n }
end

dic = Array.new(4**12, false)
gets.to_i.times {
	str = gets.chomp.split(" ")
	add = StrToAddress(str[1])

	case str[0]
	when "insert"
		dic[add] = true
	when "find"
		if dic[add]
			puts "yes"
		else
			puts "no"
		end
	end
}