class Dic
  def initialize
    @aword = [" "]
    @cword = [" "]
    @gword = [" "]
    @tword = [" "]
  end
  
  def insert(str)
    case str.split(//)[0]
    when "A"
      @aword << str
    when "C"
      @cword << str
    when "G"
      @gword << str
    when "T"
      @tword << str
    end
  end
  
  def find(str)
    case str.split(//)[0]
    when "A"
      @aword.sort!
      words = @aword
    when "C"
      @cword.sort!
      words = @cword
    when "G"
      @gword.sort!
      words = @gword
    when "T"
      @tword.sort!
      words = @tword
    end
    if include?(words, str)
      puts 'yes'
    else
      puts 'no'
    end
  end
  
  def include?(arr, n)
    if arr.length == 1
      return arr[0] == n
    else
      if arr[arr.length / 2] <= n
        return include?(arr[arr.length / 2..arr.length - 1], n)
      else
        return include?(arr[0...arr.length / 2], n)
      end
    end
  end
end
dic = Dic.new
gets.to_i.times do
  dic.send(*gets.split(" "))
end