solved problem 6 easily