#20131026

while true
	line = gets.chomp
	break if line == "."
	stack = []
	flag=true
	line.length.times{|index|
		break if !flag
		stack.push line[index] if /["("]|["\["]|["<"]/.match line[index]
		if /[")"]|["\]"]|[">"]/.match line[index]
			str = stack.pop
			flag = false if str == nil
			break if str == nil
			flag = false if !(str.bytes[0] == line[index].bytes[0]-1||str.bytes[0] == line[index].bytes[0]-2)
		end
	}
	flag = false if stack.length != 0
	puts "yes" if flag
	puts "no" if !flag
end