Max Sortable Values in Quadratic Time Limit