#!/usr/bin/env ruby

n = gets.chomp.to_i

dict = {}
n.times do
  action, str = gets.chomp.split
  str = str.tr('ACTG', '1234').to_i
  case action
  when 'insert'
    dict[str] = 1
  when 'find'
    puts dict[str] ? 'yes' : 'no'
  end
end