#include <stdio.h>
#include <string.h>
int main(void)
{
    char s[128], stack[128];
    while (fgets(s, 128, stdin)) {
        int n=strlen(s)-1;
        char* p=strchr(s, '\n');
        int i, ok=1, sp=0;
        if (p) *p=0;
        if (*s=='.' && n==1) break;

        for(i=0;i<n;++i) {
            switch (s[i]) {
                case '(': stack[sp++]=s[i]; break;
                case ')': if (stack[--sp]!='(') ok=0; break;
                case '[': stack[sp++]=s[i]; break;
                case ']': if (stack[--sp]!='[') ok=0; break;
            }
        }
        ok=ok&&sp==0;
        puts(ok ? "yes" : "no");
    }
    return 0;
}