// Aizu 1173: The Balance of the World
// 2017.9.13 bal4u@uu

#include <stdio.h>

char buf[110], *p;

int parse()
{
//	printf("%s\n", p);
	if (*p == ')' || *p == ']') return 0;
	while (*p) {
		if (*p == '(') {
			if (*(p+1) == ')') p+=2;
			else if (*(p+1) == ']') return 0;
			else { p++;
				if (!parse()) return 0;
				if (*p++ != ')') return 0;
			}
		} else if (*p == '[') {
			if (*(p+1) == ']') p+=2;
			else if (*(p+1) == ')') return 0;
			else { p++;
				if (!parse()) return 0;
				if (*p++ != ']') return 0;
			}
		} else return 1;
	}
	return 1;
}

int main()
{
	int f;
	char t[120], *q;

	while (1) {
		fgets(t, 110, stdin); if (t[0] == '.' && (!t[1] || !t[2])) break;
		p = buf, q = t; while (*q) {
			if (*q == '(' || *q == ')' || *q == '[' || *q == ']') *p++ = *q++;
			else q++;
		}
		*p = 0, p = buf;
		f = parse(); if (*p == ')' || *p == ']') f = 0;
		puts(f ? "yes" : "no");
	}
	return 0;
}