Simple,
take both the hours, and the beginning time they start at,
8:00 AM
For the first painter:
8:00 AM+10 hours...
Beginning at 8..
9,10,11,12,1,2,3,4,5,6
Thus, the FIRST painter will end at 6 P.M.
Now, the second painter:
8:00 AM+6 hours
Beginning at 8....
9,10,11,12,1,2
Thus, the second painter will end at 2 P.M.