Find the coefficients with the Tr+1 formula, I think coeff of x^17 is 36p^7q^2 and coeff of 27 is p^9. Equate them, move p^9 to the side of 36pq (blah, sorry not bothered to add powers), then factor out p^7, which will leave (36q^2 - p^2), which can be factored out with difference of two squares --> p^7(6q+p)(6q-p) = 0, then p^7 fades out of existence because p has to be a positive integer
I think from there you can apply null factor law and say 6q - p = 0, which can be rearranged to say p - 6q = 0
(Someone please correct if I am wrong, kind of uncertain about the last bit)
Edit: 2nd para is wrong, while 6q - p can be rearranged to say p - 6q is zero, you can't take the other factor as they both have to be positive integers (as the working out above me stated)