solution for p2