{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Functor
import Control.Monad
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import qualified Data.ByteString.Char8 as B

main :: IO()
main = do
  n <- readLn :: IO Int
  ss <- B.getContents :: IO B.ByteString
  mapM_ putStrLn $ solve'' ss

insertB = B.pack "insert"
findB = B.pack "find"

solve'' :: B.ByteString -> [String]
solve'' = reverse . snd . foldl' f (Set.empty, []) . B.lines
  where
    f :: (Set.Set B.ByteString, [String]) -> B.ByteString -> (Set.Set B.ByteString, [String])
    f !(dic, ss) !c
      | command == insertB = {-# SCC insert #-} let newDic = Set.insert key dic
                             in key `seq` newDic `seq` (newDic, ss)
      | command == findB = {-# SCC find #-} let val = if Set.member key dic then "yes" else "no"
                            in val `seq` (dic, val:ss)
      where (command:key:_) = B.words c
  
