#include <stdio.h>

char stack[100];
int sp=0;

int main(int argc, char* argv[]){
	char a, prev='.';

	while(scanf("%c",&a)){
		if(a=='\n') continue;
		switch(a){
			case '(': stack[sp]='('; sp++; break;
			case '[': stack[sp]='['; sp++; break;
			case ')':
				if(sp>0 && stack[sp-1]=='(') sp--;
				else { while(a!='.') scanf("%c",&a); sp=0; printf("no\n"); }
				break;
			case ']':
				if(sp>0 && stack[sp-1]=='[') sp--;
				else { while(a!='.') scanf("%c",&a); sp=0; printf("no\n"); }
				break;
			case '.':
				if(prev=='.') return 0;
				if(sp==0) printf("yes\n"); else printf("no\n"), sp=0;
		}
		prev=a;
	}
}