import sys
input = sys.stdin.readline

ret = []
for s in sys.stdin:
    if s == '.':
        break

    st = []
    r = ''
    for c in s:
        if c in ['(', '[']:
            st.append(c)
        elif c == ')':
            if len(st) > 0 and st.pop() == '(':
                pass
            else:
                r = 'no'
                break
        elif c == ']':
            if len(st) > 0 and st.pop() == '[':
                pass
            else:
                r = 'no'
                break
    
    if not r:
        if len(st) == 0:
            r = 'yes'
        else:
            r = 'no'

    ret.append(r)

print(*ret, sep='\n')