Minimum diagonal in a matrix - Python