Solving double assignment problem.