M = 1046527

def gen_h(key, i)
  ( h1(key) + i * h2(key) ) % M
end

def h1(key)
  key % M
end

def h2(key)
  1 + ( key % ( M - 1 ) )
end

def str2key(str)
  str.chars.map do |c|
    case c
    when 'A'; 1;
    when 'C'; 2;
    when 'G'; 3;
    when 'T'; 4;
    else
    end
  end.each.with_index.inject(0) do |acc, (n, idx)|
    acc += n * 5 ** idx
  end
end

def insert(str, store)
  i = 0
  key = str2key(str)
  loop do
    h = gen_h(key, i)
    break if store[h] == str
    break store[h] = str if store[h].nil?
    i += 1
  end
end

def find(str, store)
  i = 0
  key = str2key(str)
  ret = nil
  loop do
    h = gen_h(key, i)
    break ret = str if store[h] == str
    break ret = nil if store[h].nil?
    i += 1
  end
  ret
end

n = gets.to_i
store = []
n.times do
  c, str = gets.split
  case c
  when 'insert'
    insert(str, store)
  when 'find'
    puts find(str, store) ? 'yes' : 'no'
  else
  end
end
