solved task 6 of problem set 2