#include<stdio.h>
#include<stdlib.h>
#define N 100

int main(){
  int i,length=0;
  char array[100],s[100],c;

  while(fgets(s,N,stdin),s[0]!='.'){
  for(i=0;s[i]!='\0';i++){
    c=s[i];
    if(c=='(' || c=='['){
      array[length]=c;
      length++;
    }
    else if(c==')'){
      if(array[length-1]=='('){
	length--;
      }
      else{
	length=-1;
	break;
      }
    }
    else if(c==']'){
      if(array[length-1]=='['){
	length--;
      }
      else{
	length=-1;
	break;
      }
    }
  }
  if(length==0)
    printf("yes\n");
  else
    printf("no\n");
  
  length=0;
  }
  
  return 0;
}