//
//  main.c
//  The Balance of the World
//
//  Created by x15071xx on 2016/06/08.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

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

int main(int argc, const char * argv[]) {
    
    
    while (1) {
        
        char a[101]={0};
        int i,x=0,y=0,xx=0,yy=0;
        
        
        gets(a);
        
        if(strcmp(a, ".") == 0){
            break;
        }
        
        for (i = 0 ; i < strlen(a); i++) {
            
            if (a[i] == '(') {
                x++;
                xx++;
                yy--;
            } else if (a[i] == ')') {
                x--;
                yy++;
                xx--;
            } else if (a[i] == '[') {
                y++;
                yy++;
                xx--;
            } else if (a[i] == ']') {
                y--;
                xx++;
                yy--;
            }
            
            if (x < 0 || y < 0) {
                printf("no\n");
                break;
            }
            
            
            
        }
        
        if (xx == 2 || yy == 2) {
            printf("no\n");
            continue;
        }
        
        if (x == 0 && y == 0) {
            printf("yes\n");
        }
        
    }
    
    
    return 0;
}