For integral $m$, let $p(m)$ be the greatest prime divisor of $m$. By convention, we set $p(\pm1)=1$ and $p(0)=\infty$. Find all polynomials $f$ with integer coefficients such that the sequence \[\{p(f(n^2))-2n\}_{n\geq0}\] is bounded above. (In particular, this requires $f(n^2)\neq0$ for $n\geq0$.)