MinCut problem

done, but I'm sure it can be done better. I'll try tommorow