Let us assume that the total work is 24x units. So John will do 12.5% of 24x = 3x work on the last day.
Since John alone can do the work in 6 days, so he will do 4x units of work per day.
21 x units of work is done in 2 or 4 or 6 or 8 or 10 days. Beyond this John alone would have done more than 21 x units of work.
2 days ⇒ David 17x in 1 day ⇒ Working alone it would take him
days
4 days ⇒ David 6.5x in 1 day ⇒ Working alone it would take him
days
6 days ⇒ David 3x in 1day ⇒ Working alone itwould take him 8 days
8 days ⇒ David 1.25x In 1day ⇒ Working alone it would take him
days
10 days ⇒ David
in 1 day ⇒ working alone it would take him 120 days