#include <stdio.h>
#define MAX 128

char stack[MAX];

int main(void) {
    char input[MAX];
    while (1) {
        fgets(input, MAX-1, stdin);
        if (input[0] == '.') break;
        int i = 0;
        int index = 0;
        int balance = -1;
        while (1) {
            if (input[i] == '(' || input[i] == '[') {
                stack[index++] = input[i];
            } else if (input[i] == ')') {
                if(index == 0) {
                    balance = 0;
                } else if (stack[--index] != '(') {
                    balance = 0;
                }
            } else if (input[i] == ']') {
                if (index == 0) {
                    balance = 0;
                } else if (stack[--index] != '[') {
                    balance = 0;
                }
            } else if (input[i] == '.') {
                if (index == 0) {
                    balance = 1;
                } else {
                    balance = 0;
                }
            }
            if (balance != -1) break;
            i++;
        }
        if (index == 0 && balance != 0) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }
    return 0;
}

