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

char stack[1024];
int h = 0;

void push(char ch)
{
    stack[h++] = ch;
}

char pop(void)
{
    return stack[--h];
}

int main(void)
{
    while(1){
        char line[126];
        int index = 0;
        int flag = 0;
        h = 0;

        fgets(line, sizeof(line), stdin);
        line[strlen(line) - 1] = '\0';

        if(strcmp(line, ".") == 0)
            break;

        while(line[index] != '.'){
            char ch;
            switch(line[index]){
                case '(':
                    push('(');
                    break;
                case ')':
                    if(h <= 0)
                        flag = 1;
                    else{
                        ch = pop();
                        if(ch != '(')
                            flag = 1;
                    }
                    break;
                case '[':
                    push('[');
                    break;
                case ']':
                    if(h <= 0)
                        flag = 1;
                    else{
                        ch = pop();
                        if(ch != '[')
                            flag = 1;
                    }
                    break;
            }
            index++;
        }

        if(h == 0 && flag == 0)
            printf("yes\n");
        else
            printf("no\n");

    }

    return 0;
}