COMC 2020 B Problem 1

The set S contains 6 distinct positive integers. The average of the two smallest numbers is 5 and the average of the two largest is 22. What is the greatest possible average of all the numbers in the set S?