#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ALDS1_4-C2
Search - Dictionary
Search III

Constraints
    A string consists of 'A', 'C', 'G', or 'T'
    1 ??? length of a string ??? 12
    n ??? 1000000
=end

def binsrch(x, s)
# returns smallest i, which is c<=s[i], equal_to or smaller_than should be judged by caller
# returns s.length if c > s.last
  c = x[0]
  i=0
  j=s.length-1
  return   i if s==[] or c < s[i][0]
  return j+1 if c > s[j][0]
  while i < j do
    k=(i+j)/2
    if c == s[k][0] then
      return k
    elsif c == s[j][0] then
      return j
    elsif c < s[k][0] then
      j=k
    else
      i=k+1
    end
  end
  i
end

class Dict
  def initialize
    @dic = []
  end

  def insert(x)
    i = binsrch(x, @dic)
    @dic[i,1] = [x] + @dic[i,1] 
    x
  end

  def find0(s)
    @dic.index(s)
  end

  def find(x,*leftmost)
    i=binsrch(x, @dic)
    if i<@dic.length and @dic[i][0] == x[0] then
      if leftmost.length==0 then
        @dic[i][1]
      else
        begin
          i = i - 1
        end while i>=0 and @dic[i][0] == x[0]
        @dic[i+1][1]
      end
    else
      nil
    end
  end

  def sort
    @dic = @dic.sort{|x,y| if x[0]<y[0] then -1
              elsif x[0]>y[0] then +1
              else x[1]<=>y[1]
              end}
  end

end

class Main
  def initialize()
    #fh = open("/home/muz/Downloads/x.txt")
    #fh = open("/home/muz/Downloads/ALDS1_4_C_in2.txt")
    #fh = open("/home/muz/Downloads/ALDS1_4_C_in9.txt")
    fh = STDIN
t0=Time.now
    commands = []
    n = fh.gets.chomp.to_i
    0.upto(n-1){|i|
      begin
        f=fh.gets.split
      rescue => exe
          abort("not enough command?")
      else
        commands.push([f[0],f[1],i])
      end
    }
 #   puts "HERE1:#{Time.now-t0}s"
    cI = commands.select{|x|x[0]=="insert"}
    cF = commands.select{|x|x[0]=="find"}

    dt = Dict.new()
    cI.each {|x|
      cmd,op,n = x
      dt.insert([op,n])
    }
#puts "HERE2:#{Time.now-t0}s"
#    puts "cF.size=#{cF.length}"
    dt.sort
#puts "HERE3:#{Time.now-t0}s"

    m=0
    cF.each {|x|
      cmd,op,n = x
      a = dt.find([op,n],true)    #find returns n or nil

  #    puts "HERE3:#{m}:#{Time.now-t0}s" if m%100000==0
      if a and a < n then
        puts "yes"
        #puts "#{[op,n]} yes"
      else
        puts "no"
        #puts "#{[op,n]} no"
      end
      m += 1
    }
#puts "HERE4:#{Time.now-t0}s"

  end

end

if $0==__FILE__ then
  Main.new()
end