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

int main(void)
{
	char str[128];
	char stack[128];
	char t[512];
	int stack_n;
	int i;
	int ok;

	t['['] = ']';
	t['('] = ')';

	while (1){
		fgets(str, sizeof(str), stdin);
		if (str[0] == '.') break;

		memset(stack, 0, sizeof(stack));
		stack_n = 0;
		ok = 1;

		for (i = 0; str[i] != '\0'; i++){
			if (str[i] == '(' || str[i] == '['){
				stack_n++;
				stack[stack_n] = str[i];
			}
			else if (str[i] == ')' || str[i] == ']'){
				if (t[stack[stack_n]] != str[i]){
					ok = 0;
				}
				stack_n--;
			}
		}

		puts(ok && stack_n == 0 ? "yes" : "no");
	}

	return (0);
}