while True: stack = [] line = input() if line=="." : break isBalance = True for c in line: if c == "(": stack.append(c) elif c== ")": if not stack or stack[-1] != "(": isBalance = False break stack.pop() elif c == "[": stack.append(c) elif c== "]": if not stack or stack[-1] != "[": isBalance = False break stack.pop() print("yes" if isBalance and not stack else "no")