add partial answer to problem 6