#include<stdio.h>

int main()
{
	int l1,l2;
	char buf[101];
	int i,j,flag;
	int last[100];
	while(1){
		for( i = 0 ; i < 101 ; i++ ){
			buf[i] = '\0';
		}
		fgets(buf,100,stdin);
		if( buf[0] == '.' && buf[1] == '\n' ) break;
		l1 = 0;
		l2 = 0;
		flag = 1;
		for( i=0 ; buf[i] != '\n' ; i++){
			if( buf[i] == '(' ){
				l1++;
				last[l1+l2] = 1;
			}else if( buf[i] == ')' && l1 > 0  ){
				if( last[l1+l2] != 1 ){
					flag = 0;
					break;
				}
				last[l2+l1] = 0;
				l1--;
			}else if( buf[i] == ')' && l1 <= 0 ){
				flag = 0;
				break;
			}
			if( buf[i] == '[' ){
				l2++;
				last[l2+l1] = 2;
			}else if( buf[i] == ']' && l2 > 0 ){
				if(last[l1+l2] != 2){
					flag = 0;
					break;
				}
				last[l2+l1] = 0;
				l2--;
			}else if( buf[i] == ']' && l2 <= 0 ){
				flag = 0;
				break;
			}
		}
		if( l1 != 0 || l2 != 0 ) flag = 0;
		if( flag == 0 ){
			printf("no\n");
		}else{
			printf("yes\n");
		}
	}
	return 0;
}
