/*
 * Copyright (C) 2011, 2016 Hiroyasu Kamo
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/*
 * ACM-ICPC 2011 Japan Domestic Contest
 *  Problem B  The Balance of the World
 *
 *	Author: Hiroyasu Kamo <wd@ics.nara-wu.ac.jp>
 */

#include <iostream>
#include <string>
#include <stack>

inline bool
corresponding_brackets(char c_open, char c_close)
{
	switch (c_close) {
	case ')':
		return c_open == '(';
	case ']':
		return c_open == '[';
	}
	return false;
}

bool
is_balanced(const std::string &str)
{
	std::stack<char>	bra;
	for (auto p = str.begin(); p != str.end(); ++ p) {
		switch (*p) {
		case '(':
		case '[':
			bra.push(*p);
			break;
		case ')':
		case ']':
			if (bra.empty() || !corresponding_brackets(bra.top(), *p))
				return false;
			bra.pop();
			break;
		case '.':
			return bra.empty();
		}
	}
	return false;
}

int
main(int argc, char **argv)
{
	for (std::string str; getline(std::cin, str) && str != "."; ) {
		std::cout << (is_balanced(str) ? "yes" : "no") << std::endl;
	}
	return 0;
}
