import scala.io.StdIn.{readInt,readLine}
import scala.collection.mutable.ArrayBuffer

object Main extends App {
  type Set = String => Boolean

  def contains(s:Set, elem:String):Boolean = s(elem)
  def singletonSet(elem:String):Set = x => x==elem
  def union(s:Set, t:Set):Set = x => contains(s,x) || contains(t,x)

  val n = readInt

  def loop(i:Int, s:Set, a:ArrayBuffer[String]):ArrayBuffer[String] =
    if(i>n) a
    else {
      val l = readLine.split(" ")
      val isInsert = l(0)(0) == 'i'
      val newSet = if(isInsert) union(singletonSet(l(1)),s) else s
      if(!isInsert && contains(s,l(1))) a += "yes"
      else if(!isInsert && !contains(s,l(1))) a+="no"
      loop(i+1, newSet, a)
    }
  println(loop(1, singletonSet("-"),new ArrayBuffer[String]()).mkString("\n"))
}
