Solution for Exercise 6.