{-
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_C&lang=jp
?????????: Search - Dictionary
-}
import Control.Monad
import Control.Applicative

import qualified Data.Set as S


-- ????????????????¨???????????????????????????????StateT???????????????????????§?£???????http://www.geocities.jp/m_hiroi/func/haskell30.html ???????????????
newtype StateT s m a = StateT {runStateT :: s -> m (a, s)}

instance Monad m => Functor (StateT s m) where fmap = liftM
instance Monad m => Applicative (StateT s m) where
 pure = return
 (<*>) = ap

instance Monad m => Monad (StateT s m) where
  return x = StateT $ \s -> return (x, s)
  m >>= k  = StateT $ \s -> do (a, s') <- runStateT m s
                               runStateT (k a) s'
  fail s   = StateT $ \_ -> fail s

get :: Monad m => StateT s m s
get = StateT $ \s -> return (s, s)

put :: Monad m => s -> StateT s m ()
put s = StateT $ \_ -> return ((), s)

lift m = StateT $ \s -> do {a <- m; return (a, s)}





data Info = Insert String | Find String

main = do
 n <- fmap read getLine
 void $ actions n `runStateT` S.empty
 

f str = case words str of
 ["insert", a] -> Insert a
 ["find", a] -> Find a

actions :: Int -> StateT (S.Set String) IO ()
actions n = sequence_ $ replicate n $ do
 info <- lift $ fmap f getLine
 action info

action :: Info -> StateT (S.Set String) IO ()
action (Insert a) = do
 s <- get
 put $ S.insert a s
action (Find a) = do
 s <- get
 lift . putStrLn $ (if a `S.member` s then "yes" else "no") 