Observe the diagrams I and II carefully

Observe the diagrams I and II carefully. An object of mass m is lifted from A to B to height h along path 1 and path 2. What would be the work done on the object in both the cases? Give reasons for your answer.
Work done in diagram I = mgh. Work done in diagram II = mgh. Work done by gravity depends on the differences in vertical heights of the initial and final positions of the object and not on the path along which the object is moved.