I hadn't read about direct products up to this problem so it didn't come to me to use them, and I completely missed that solution of part two could be used. Thanks a lot for your solution, using it I was able to find an alternative which avoids direct products, essentially the idea is to show that the center of P is in the center of G, which is also what your solution does, thanks again!