Solution for puzzle 4