On the optimality conditions of the two-machine flow shop problem