solution for p4