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

int main()
{
  int i,j,n1,n2,head;
  char S[101],SS[101];

  while(1){
    fgets(S,sizeof(S),stdin);
    if(S[0]=='.')break;
    head=0;
    for(i=0;i<strlen(S)-1;i++){
      if(S[i]=='[' ||S[i]=='('){
	SS[head++]=S[i];
      }
      if(S[i]==']' &&SS[head-1]=='[')head--;
      if(S[i]==')' &&SS[head-1]=='(')head--;
      if((S[i]==']' &&SS[head-1]=='(')||(S[i]==')' &&SS[head-1]=='[')){
	head=100;
        break;
      }
    }
    if(head==0)printf("yes\n");
    else printf("no\n");
    
  }
  
  return 0;
}