loop do
  catch :a do
    s = gets.chomp
    exit if s == "."

    stack = []
    s.chars.each do |ch|
      if ((ch == ")" || ch == "]") && stack.empty?) || (ch == ")" && stack.last == "[") || (ch == "]" && stack.last == "(")
        puts "no"
        throw :a
      end
      stack.push ch if ch == "("
      stack.pop if ch == ")" && stack.last == "("
      stack.push ch if ch == "["
      stack.pop if ch == "]" && stack.last == "["
    end

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