class Dic
  def initialize
    @word = Array.new((2 ** 26 - 4) / 3, false)
    @char = {"A" => 0, "C" => 1, "G" => 2, "T" => 3}
  end
  
  def insert(str)
    @word[to_i(str.split(//))] = true
  end
  
  def find(str)
    if @word[to_i(str.split(//))]
      puts "yes"
    else
      puts "no"
    end
  end
  
  private
  def to_i(str)
    if str.length == 1
      return @char[str[0]]
    else
      return @char[str.pop] + 4 * to_i(str) + 4
    end
  end
end
def testf
  test = open("dic2.txt")
  dic = Dic.new
  test.gets
  while str = test.gets
    puts str
    dic.send(*str.split(" "))
  end
  test.close
end
def f
  dic = Dic.new
  gets.to_i.times do
    dic.send(*gets.chomp.split(" "))
  end
end
f