import scala.io.StdIn

object Main extends App {
  
  val max = 84*12 // T * 12 char: 1008
  val min = 65*12 // A * 12 char:  780
  // 
  // 16,777,216

  val m = max
  val arrayMax = 1000000
  
  def ctoi(data: String) = data.foldLeft(0)((acc, e) => acc+e)
  
  // A: 65, C:67, G:71, T:84
  def makeHash1(key: Int) = {
    key % m
  }

  def makeHash2(key: Int) = {
    1 + key % (m - 1)
  }
  
  def makeHash(key: Int, i: Int) = {
    (makeHash1(key) + i * makeHash2(key)) % m
  }

  val n = StdIn.readLine().trim.toInt

  val dict = Array.fill(arrayMax)("")
  
  def insert(data: String): Unit = {
    var i = 0
    val key = ctoi(data)
    var colision = true
    while(colision){
      val j = makeHash(key, i)
      if(dict(j) == "") {
        dict(j) = data
        colision = false
      }
      else i = i + 1
    }
  }

  def search(data: String): Int = {
    val key = ctoi(data)
    var i = key
    var ret = -1
    while(ret < 0 && i < arrayMax){
      if(dict(i) == data) {
        ret = i
      }
      i += 1
    }
    ret
  }
  
  val result = (0 until n).map{ _ =>
    val cmd = StdIn.readLine().split(' ')
    if(cmd(0) == "insert"){
      insert(cmd(1))
      ""
    } else {
      if(search(cmd(1)) >= 0) f"yes%n" else f"no%n"
    }
  }.filterNot( p => p == "")
  
  print(result.mkString(""))
  
}

