working solution for 6