import qualified Data.Map as M
import Control.Applicative
import Control.Monad.State
import Data.Maybe (fromMaybe)

type Dictionary = M.Map String String

type Query = StateT Dictionary IO ()

main = do
    n <- readLn
    runQuery n

runQuery :: Int -> IO ()
runQuery n = evalStateT (queries n) M.empty

queries :: Int -> Query
queries 0 = return ()
queries n = do
    query
    queries (n-1)

query :: Query
query = do
    [c,str] <- lift $ words<$>getLine
    case c of
      "insert" -> insertQ str
      "find"   -> findQ str

insertQ :: String -> Query
insertQ str = modify (M.insert str "yes")

findQ :: String -> Query
findQ str = do
    res <- M.lookup str<$>get
    liftIO $ putStrLn $ fromMaybe "no" res

