#include <stdio.h>
#include <string.h>

int main()
{
	char read[101];
	char data[1000001] = "\0";
	char log[10001] = "\0";
	int i;
	int len_r, len_d;
	int lm, lk, rm, rk;
	int pos;
	int judge;
	while(1){
		lm = 0; rm = 0; lk = 0; rk = 0;
		pos = 0;
		judge=0;
		while(1){
			fgets(read, sizeof(read), stdin);
			len_r = strlen(read);
			read[len_r-1]='\0';
			len_r--;
			if(read[0]=='.'&&len_r==1){
				break;
			}
			strcat(data, read);
			len_d = strlen(data);
			if(data[len_d-1]=='.'){
				for(i=0; i<len_d; i++){
					if(data[i]=='('){
						lm++;
						log[pos] = '(';
						pos++;
					}
					else if(data[i]=='['){
						lk++;
						log[pos] = '[';
						pos++;
					}
					else if(data[i]==')'){
						if(log[pos-1]!='('){
							judge=0;
							goto result;
						}
						rm++;
						pos--;
					}
					else if(data[i]==']'){
						if(log[pos-1]!='['){
							judge=0;
							goto result;
						}
						rk++;
						pos--;
					}
					if(lm<rm||lk<rk){
						judge=0;
						goto result;
					}
				}
				if(lm==rm&&lk==rk){
					judge++;
				}
				else{
					judge=0;
				}
result:			if(judge){
					printf("yes\n");
				}
				else{
					printf("no\n");
				}
				data[0]='\0';
				log[0] ='\0';
				break;
			}
		}
		if(read[0]=='.'&&len_r==1&&strlen(data)==0){
			break;
		}
	}
	return 0;
}