import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn
object Main extends App {

  val n = StdIn.readLine().trim.toInt
  
  // RuntimeError !! (Hash値が悪さしている？)
  //val result = (0 until n).foldLeft(ListBuffer.empty[String], HashSet.empty[String]){
  val result = (0 until n).foldLeft(ArrayBuffer.empty[String], Set.empty[String]){
      case ((acc, dict), _) =>
    val cmd = StdIn.readLine().split(' ')
    if(cmd(0) == "insert"){
      (acc, dict + cmd(1))
    } else {
      if(dict.contains(cmd(1))) {
        (acc += "yes", dict)
      } else {
        (acc += "no", dict)
      }
    }
  }
  println(result._1.mkString(f"%n"))

}
