class Dictionary
  def initialize
    @words = []
    @orders = []
  end

  def insert(word, line)
    @words << [word, line]
  end

  def find(word, line)
    @orders << [word, line]
  end

  def b_search(array, f)
    if array.size == 1
      return array[0]
    else
      if array[array.size / 2 - 1][0] >= f
        return b_search(array[0...array.size / 2], f)
      else
        return b_search(array[array.size / 2..-1], f)
      end
    end
  end

  def exp
    @words.sort!
    @orders.each{|o|
      sus = b_search(@words, o[0])
      if sus[0] == o[0] and sus[1] < o[1]
        puts "yes"
      else
        puts "no"
      end      
    }
  end
end
def main(input = $stdin)
  dic = Dictionary.new
  n = input.gets.to_i
  n.times do |line|
    dic.send(*input.gets.split(" "), line)
  end
  dic.exp
end
main