import scala.io.StdIn
object Main extends App {
  val n = StdIn.readLine().trim.toInt
  val result = (0 until n).foldLeft(List.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))) {
        ("yes" :: acc, dict)
      } else {
        ("no" :: acc, dict)
      }
    }
  }

  println(result._1.reverse.mkString(f"%n"))

}
