A lending scheme for a system of interconnected banks with probabilistic constraints of failure