#include <stdio.h>

void push(char);
char pop(char);

char s[100];
int top = 0;

int main(){
  char c[101], x, r[100];
  int i, j, count;
  int ok;
  while(1){
    ok = 1;
    count = 0;
    i = 0;
    top = 0;
    while(1){
      scanf("%c",&c[i]);
      if(c[i] == '\n')
	break;
      i++;
    }


    if(c[0] == '.') break;
    for(i = 0 , j = 0 ; c[i] != '.' ; i++){
      if(c[i] == '(' || c[i] == '[' || c[i] == ')' || c[i] == ']'){
	r[j] = c[i];
	j++;
	count++;
      }
    }
    
    /*    for ( j = 0; j < count; j++ ){
      printf("%c", r[j]);
    }
      printf("\n");
    */
    for(j = 0 ; j < count ; j++){
      if(r[j] == '(' || r[j] == '['){
	push(r[j]);
      } else if(r[j] == ')' || r[j] == ']'){
	if(top == 0){
	  ok = 0;
	  break;
	}
	x = pop(r[j]);
	if((x == '(' && r[j] != ')') || (x == '[' && r[j] != ']')){
	  ok = 0;
	  break;
	}
      }
    }
    if(top != 0)
      ok = 0;


    if ( ok == 1)
      printf("yes\n");
    else 
      printf("no\n");
  }
  return 0;
}
void push(char x){
  top++;
  s[top] = x;
}
char pop(char x){
  x = s[top];
  top--;
  return x;
}