First version of Dinic algo