finished the second problem