import java.util.*

fun main(args:Array<String>?): Unit {
    while (true) {
        val str = readLine()!!
        if (str == ".") return
        val stack = Stack<Char>()
        var valid = true
        loop@for (c in str){
            when(c){
                '(' -> stack.push(c)
                '[' -> stack.push(c)
                ')' -> {
                    if (stack.isEmpty() || stack.pop() != '(') {
                        valid = false
                        break@loop
                    }
                }
                ']' -> {
                    if (stack.isEmpty() || stack.pop() != '[') {
                        valid = false
                        break@loop
                    }
                }
            }
        }
        println(
                if (valid && stack.isEmpty()) "yes" else "no"
        )
    }
}
