assignment 2, P2 and P3