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

int main() {

  char str[10000],kara;
  int i,j,k,t;
  int kr1,kr2,ks1,ks2,flag = 0;
  

  while(1) {
    int ks[101] = {0};
    int kr[101] = {0};
    int end[102] = {0};
    kr1 = kr2 = ks1 = ks2 = 0;
    flag = 0;

    i = 0;
    k = 0;
    while(1) {
      // printf("str[%d] = %c\n",i,str[i]);
      scanf("%c",&kara);
      if(kara == '.' && k == 0) {
	flag = 1;
	break;
      }
      if(kara == '.' && k == 1) {
	scanf("%c",&kara);
	break;
      }

      if(kara == '[' ||  kara == ']' || kara == '(' || kara == ')') {
	str[i] = kara;
	i++;
	//	printf("str[%d] = %c\n",i-1,str[i-1]); 
      } 

      k = 1;
    }

    k = i;
    t = 0;
    for(i=0;i<k;i++) {
      if(flag == 1) break;

      if(str[i] == '[') {
	end[t] = -1;
	ks1++;
	ks2++;
	t++;
      }
      else if(str[i] == '(') {
	end[t] = -2;
	kr1++;
	kr2++;
	t++;
      } else if(str[i] == ']') {
	ks2--;
	if(end[t-1] == -1) {
	  ks1--;
	  t--;
	}
      } else if(str[i] == ')') {
	kr2--;
	if(end[t-1] == -2) {
	  kr1--;
	  t--;
	}
      }
    }

   
    //  printf("kr1 = %d\nks1 == %d\n",kr1,ks1);
    
    
    
    
    if(flag == 1) break;

    //    printf("ks2 = %d\nkr2 = %d\n",ks2,kr2);  
  if(ks1 == 0 && kr1 == 0 && flag == 0 && ks2 == 0 && kr2 == 0) printf("yes\n");
  else printf("no\n");
  
  }
  
  return 0;
  
}