class Dictionary
  DNA = [''] + %w(A C G T)

  def initialize n
    @size = 100000
    @container = Array.new(@size)
  end
  attr_accessor :ret

  def exec command, str = ''
    case command
    when 'insert' then insert str
    when 'find'   then puts(find?(str) ? 'yes' : 'no')
    else raise '??????'
    end
  end

  #private

  def insert str
    #puts "#{str} : #{hash(str)}"
    if @container[hash(str)].nil?
      @container[hash(str)] = LinkList.new str
    else
      group = @container[hash(str)]
      found = group.has? str
      group.insert(str) unless found
    end
  end

  def find? str
    linked_list = @container[hash(str)]
    return false if linked_list.nil?

    linked_list.has?(str)
  end

  def hash str

    return str.hash % @size
    # ?¶??´???´???????£? (????????????)
    # AGCT -> 4?????° -> 10?????°???????????????
    #base = DNA.size
    #size = str.size
    #sum = 0
    #str.chars.each.with_index {|c, index|
    #  # ????????????4?????°??§??¨?????????
    #  n = get_dna_index c
    #  # ?????????????????????10?????°?????????
    #  # (??? ** ??????????????????) * ???
    #  # ?????????????????????10?????°???????????¨????¶????
    #  sum += (base ** (size - index)) * n
    #}

    #sum % @size
  end

  def get_dna_index char
    DNA.index char
  end

  # ??????????????\???????????????????´?????????????????????????
  class LinkList

    def initialize first_value
      @first = Node.new first_value, nil
    end

    def insert key
      new_node = Node.new key, @first
      @first = new_node
    end

    def has? key
      current = @first
      until current.nil?
        if current.key == key
          return true
        else
          current = current.next
        end
      end
      false
    end

    # ????????????????????¨?????¢?????????
    class Node
      def initialize key, next_node
        @key = key
        @next = next_node
      end
      attr_accessor :key, :next
    end
  end
end

def main size, commands
  dic = Dictionary.new size.to_i
  commands.each{|raw_command|
    command, str = raw_command.split ' '
    dic.exec(command, str)
  }
  #puts dic.ret.join "\n"
  #dic.container.each {|pii| p pii}
end

array = STDIN.read.split(/\n/)
size = array.shift

main(size, array)