loop do
  s = gets.chomp
  break if s == "."

  stack = []
  s.chars.each do |ch|
    stack << ch if ch == "("
    stack.pop if ch == ")" && stack.last == "("
    stack << ch if ch == "["
    stack.pop if ch == "]" && stack.last == "["
  end

  puts stack.empty? ? "yes" : "no"
end