Fully factorizing the given polynomials over a finite field can be done since an element of the field have the desired algebraic property. We only need to brute force over 25740 options and have a 1 in 2 chance of picking the right pair of outputs. Inspired by problem B4 on Putnam 2007. Full writeup [here](https://www.overleaf.com/read/fnjzhyxzmspq).