Refer to figure. Let ΔU1 and ΔU2 be the change in internal energy in processes A and B respectively, ΔQ be the net heat given to the system in process A + B and ΔW be the net work done by the system in the process A + B.
As seen from the figure initial state of A is the final state of B and vice-versa.
So, the change in internal energy of process A and B will be equal in magnitude but with a negative sign.
So ΔU1=-ΔU2
∴ ΔU1+ΔU2=0.