Implement solution 8.