M = 1046527
$h = []

def getChar(ch)
	case ch
	when "A"
		return 1
	when "C"
		return 2
	when "G"
		return 3
	when "T"
		return 4
	else
		return 0;
	end
end

def getKey(str)
	sum = 0
	p = 1
	str.size.times do |i|
		sum += p * getChar(str[i])
		p *= 5
	end
	return sum
end

def h1(key)
	return key % M
end

def h2(key)
	return 1 + (key % (M - 1))
end

def find(str)
	key = getKey(str)
	i = 0
	loop do
		h = (h1(key) + i * h2(key)) % M
		return true if $h[h] == str
		return false if $h[h] == nil
		i += 1
	end
	return false
end

def insert(str)
	key = getKey(str)
	i = 0
	#puts key
	loop do
		h = (h1(key) + i * h2(key)) % M
		if $h[h] == str
			return 1
		elsif $h[h] == nil
			$h[h] = str
			return 0
		end
		i += 1
	end
	return 0
end


M.times do |i|
	$h[i] = nil
end
n = gets.to_i
n.times do |ind|
	#puts ind
	com, str = gets.split
	if com[0] == "i"
		insert(str)
	else
		if find(str)
			puts "yes"
		else
			puts "no"
		end
	end
end