solved problem 6