class Dictionary
  MAX = 4**12

  def initialize
    @dict = []
  end

  def word_to_key(word)
    key = 0
    n = 1
    word.chars do |c|
      case c
      when 'A'
        key += 1 * n
      when 'C'
        key += 3 * n
      when 'G'
        key += 5 * n
      when 'T'
        key += 7 * n
      end
      n *= 6
    end
    key
  end

  def hash1(key)
    key % MAX
  end

  def hash2(key)
    key % (MAX - 1)
  end

  def insert(word)
    key = word_to_key(word)
    id = hash1(key)
    if @dict[id]
      i = 1
      id2 = id + i * hash2(key)
      while @dict[id2]
        i += 1
        id2 = id + i * hash2(key)
      end
      @dict[id2] = word
    else
      @dict[id] = word
    end
  end

  def find(word)
    key = word_to_key(word)
    id = hash1(key)
    if @dict[id] == word
      return true
    else
      i = 1
      id2 = id + i * hash2(key)
      while @dict[id2]
        return true if @dict[id2] == word
        i += 1
        id2 = id + i * hash2(key)
      end
      return false
    end
  end
end

n = gets.to_i
dict = Dictionary.new
n.times do
  cmd = gets.split
  case cmd[0]
  when "insert" then
    dict.insert(cmd[1])
  when "find" then
    puts dict.find(cmd[1]) ? "yes" : "no"
  end
end