def count(str)
  arr = [0, 0, 0, 0] # A, G, C, T
  str.each_char do |char|
    case char
    when 'A'
      arr[0] += 1
    when 'G'
      arr[1] += 1
    when 'C'
      arr[2] += 1
    when 'T'
      arr[3] += 1
    end
  end
  return arr
end

def calc_index(arr)
  index = 0
  index += arr[0] * PART_A
  index += arr[1] * PART_G
  index += arr[2] * PART_C
  index += arr[3] * PART_T
  return index
end

n = gets.chomp.to_i

PART_A = 12 ** 0
PART_G = 12 ** 1
PART_C = 12 ** 2
PART_T = 12 ** 3
array = Array.new(12 ** 4, [])

(n).times do |i|
  line = gets.chomp.split
  if (line[0] == 'insert') then
    index_arr = count(line[1])
    array[calc_index(index_arr)] << line[1]
  elsif (line[0] == 'find') then
    index_arr = count(line[1])
    target_arr = array[calc_index(index_arr)]
    puts (target_arr.include?(line[1]) ? 'yes' : 'no')
  end
end