def main(lst):
if lst[-1] != ".":
return "no"
stack = []
for word in lst:
if word == "(" or word == "[":
stack.append(word)
elif word == ")":
if len(stack) == 0 or stack[-1] != "(":
return "no"
stack.pop()
elif word == "]":
if len(stack) == 0 or stack[-1] != "[":
return "no"
stack.pop()
if len(stack) == 0:
return "yes"
return "no"
while True:
lst = list(input())
if lst == ["."]:
break
print(main(lst))