#include <stdio.h>

char stack[100];
int sp = 0;

void push(char c)
{
	stack[sp++] = c;
}

char pop(void)
{
	if (sp == 0){
		return ('X');
	}
	return (stack[--sp]);
}

int main(void)
{
	char in[101];
	int p;
	
	while (1){
		fgets(in, 110, stdin);
		if (in[0] == '.'){
			break;
		}
		sp = 0;
		p = 0;
		while (in[p] != '.'){
			if (in[p] == '(' || in[p] == '['){
				push(in[p]);
			}
			else if (in[p] == ')'){
				if (pop() != '('){
					printf("no\n");
					break;
				}
			}
			else if (in[p] == ']'){
				if (pop() != '['){
					printf("no\n");
					break;
				}
			}
			p++;
		}
		if (in[p] == '.'){
			if (sp == 0){
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
	
	return (0);
}