#!/usr/bin/env ruby
require 'set'

n = gets.chomp.to_i

dict = Set.new
n.times do
  action, str = gets.chomp.split
  str = str.tr('ACTG', '1234').to_i
  if action[0] == 'i'
    dict << str
  else
    puts dict.include?(str) ? 'yes' : 'no'
  end
end