$M = 1046527
$H= []

def char2int(c)
  case c
  when 'A' then return 1
  when 'A' then return 2
  when 'A' then return 3
  when 'A' then return 4
  else return 0
  end
end

def getKey(str)
  ret, p = 0, 1
  str.size.times do |i|
    ret += p * char2int(str[i])
    p *= 5
  end
  return ret
end

def h1(key)
  key % $M;
end

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

def find(str)
  key = getKey(str)
  i = 0
  loop do
    h = (h1(key) + i * h2(key)) % $M;
    if $H[h] == str
      return true
    elsif $H[h].nil?
      return false
    end
    i += 1
  end
end

def insert(str)
  key = getKey(str)
  i = 0
  loop do
    h = (h1(key) + i * h2(key)) % $M;
    if ($H[h] == str)
      break
    elsif $H[h].nil?
      $H[h] = str
      break
    end
    i += 1
  end
end

gets.to_i.times do
  cmd, str = gets.split(' ')
  if cmd[0] == 'i'
    insert(str)
  else
    puts find(str) ? 'yes' : 'no'
  end
end