working solution for 8)