Solution to fourth challenge