# your code goes here
# bj 4949
while True:
    text = input()
    stack = []
    for i in text:
        if i=='[' or i=='(':
            stack.append(i)
        elif '[' in stack and i==']':
            stack.pop()
        elif '(' in stack and i==')':
            stack.pop()
        elif '[' not in stack and i==']':
            stack.append(i)
        elif '(' not in stack and i==')':
            stack.append(i)

    if text=='.':
        break

    if not stack:
        print('yes')
    else:
        print('no')