sol to p2 with functions from p1