#include <stdio.h>
#include <stdlib.h>
struct sta{
  int where;
  char array[1000];
};
typedef struct sta stack;
void startstack(stack *st){
  st->where=0;
  st->array[0]=0;
}
void push(stack *st,char a){
 
  st->array[++st->where]=a;
}
char top(stack *st){
  return st->array[st->where];
}
void pop(stack *st){
  st->where--;
}
void clear(char* tmp){
  int j;
  do{
    for(j=0;tmp[j];j++);
    if(tmp[--j]=='.') break;
  }while(scanf("%s",tmp));

}
int main(){
  int i,j;
  stack st;
  char tmp[1000];
  startstack(&st);
  gets(tmp);
  while(tmp[0]!='.'||tmp[1]!=0){

    for(i=0;tmp[i];i++){
    
      if(tmp[i]=='('||tmp[i]=='['){
	push(&st,tmp[i]);
   
      }
      if(tmp[i]==']'){
	if(top(&st)=='[') pop(&st);
	else {startstack(&st);
	  clear(tmp);
	  printf("no\n");
	  break;}
      }
      if(tmp[i]==')'){
	if(top(&st)=='(') pop(&st);
	else {startstack(&st);
	  clear(tmp);
	  printf("no\n");
	  break;
	}
      }
      if(tmp[i]=='.'){
	if(top(&st)==0) {printf("yes\n");
	  startstack(&st);}
	else {printf("no\n");
	  break;}
      }
      
    }
    gets(tmp);
  }
      return 0;
}