import Control.Monad  -- unless

balanced :: String -> Bool
balanced s = balanced' fs []
  where
    fs = filter (`elem` "()[]") s
    balanced' [] stack = stack == []
    balanced' (x:xs) stack
      | x `elem` "(["                  = balanced' xs ((closing x):stack)
      | stack /= [] && x == head stack = balanced' xs (tail stack)
      | otherwise                      = False
    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"