while true
    str = gets.chomp
    break if str == "."
    arr, result = [], "yes"
    str.each_char{|c|
        case c
        when ')'
            if arr.pop != '('
                result = "no"
                break
            end
        when ']'
            if arr.pop != '['
                result = "no"
                break
            end
        when '(', '['
            arr << c
        end
    }
    result = "no" if arr != []
    puts result
end

