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

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}

int isbr(char c){
  if(c=='('){return 1;}
  if(c=='['){return 2;}
  if(c==']'){return 3;}
  if(c==')'){return 4;}
  return 0;
}

int main(){
  int i,c;
  char s[128],stk[128];
  while(fgets(s,105,stdin),(!(strlen(s)<=2&&s[0]=='.'))){
    i=0;c=0;
    while(s[i]!=0){
      if(isbr(s[i])!=0){
        if(c==0 && isbr(s[i])>=3){c=5000;break;}
        if(c!=0 && isbr(stk[c-1])+isbr(s[i])==5 && (isbr(stk[c-1])<isbr(s[i]))){
          c--;
        }
        else{
          stk[c]=s[i];
          c++;
        }
      }
      i++;
    }
    if(c==0){printf("yes\n");}
    else{printf("no\n");}
  }
  return 0;
}

