while line = gets
    s = []
    b = true
    line.chomp.each_char do |c|
        case c
        when "(", "["
            s.push(c)
        when ")", "]"
            pair = s.pop
            if (c == ")" && pair != "(") || (c == "]" && pair != "[")
                b = false
                break
            end
        end
    end
    if b && s.empty?
        puts "yes"
    else
        puts "no"
    end
end