Assume that 1 wall is 900 ft2. (This is an arbitrary number, any reasonable number can be used)
So, 5 walls = 4500 ft2 & since there are 5 people (all doing equal work) then each man paints 900 ft2 in 20 minutes.
For 9 walls, there is 8100 ft2, with 9 people, each person paints 900 ft2 but we know from above that it takes 20 minutes for each man to paint 900 ft2
So, the total time is 20 minutes.