Let $f\in\mathbb Z[x]$ be a non-constant integer polynomial, and let $n$ be a positive integer which is at least $\deg f$. Choose positive integers $a_1<\cdots<a_n$ such that $f(a_i)\neq 0$ for each $i$. Then for every choice of divisors $d_1|f(a_1),\ldots, d_n|f(a_n)$ there is at most one polynomial $g\in\mathbb C[x]$ with $\deg g<\deg f$ such that $g(a_i)=d_i$ for $i=1,\ldots,n$. This generates only finitely many choices for the polynomials $g$. These are the only possible candidates for the irreducible factors of $f$.
My question: I understand that $g$ can be constructed using Interpolation polynomial formula with degree at most $n-1$, which guarantees uniqueness (when it exists). However, I am unsure about the second part. Any suggestion is appreciated. Thank you!