import Control.Monad  -- unless

balanced :: String -> Bool
balanced s = foldl pushPop [] fs == []
  where
    fs = filter (`elem` "()[]") s
    pushPop stack x
      | x `elem` "(["                  = closing x : stack
      | stack /= [] && x == head stack = tail stack
      | otherwise                      = "E"
    closing '(' = ')'
    closing '[' = ']'


main :: IO ()
main = do
  s <- getLine
  unless (s == ".") $ do
    putStrLn . yesno . balanced $ s
    main
  where
    yesno b = if b then "yes" else "no"