If $f$ is a polynomial, $a_1=f(0)$ and $a_n$ = $f(a_{n-1})$ , conclude the integer values of $a_1$ or $a_2$ 
Let $f$ be a polynomial with integer coefficients.
We define $a_1= f(0)$
$a_2 = f (a_1)= f(f(0))$
Similarly $a_n$ = $f(a_{n-1})\ \  \forall n \geq3$
If there exists a natural number $k$ greater than or equal to $3$ such that $a_k = 0$ prove that either $a_1 =0$ or $a_2 = 0$
Source: ISI UGB 2019 paper

What I thought was that if for some $k$, $a_k$ is zero then intuitively $a_1$, $a_2$ all are zero $\dots$ but this is not correct. What I need is a rigorous proof for the above claim.
 A: EDITED (to avoid zero denominators):
I'll work through the case $k=3$, where $a_3 = 0$ and hopefully you can generalize this. Apply the Mean Value Theorem ($f$ is a polynomial, so infinitely differentiable) on $(a_2,a_3)$ (or $(a_3,a_2)$ if $a_2 > 0$) to assert that there exists $\xi$ in this interval for which
$$
f(a_3)-f(a_2) = (a_3-a_2)f'(\xi),
$$
i.e.
$$
a_1 = -a_2f'(\xi).
$$
Similarly, MVT on $(a_1,a_2)$ (or $(a_2,a_1)$) gives the existence of $\zeta$ in this interval such that
$$
f(a_2)-f(a_1)=(a_2-a_1)f'(\zeta),
$$
i.e.
$$
-a_2 = (a_2-a_1)f'(\zeta).
$$
Putting this all together, $$
a_1 = -a_2f'(\xi) = (a_2 - a_1)f'(\zeta),
$$
so either both $a_1$ and $a_2$ are zero, or you can divide through by whichever is non-zero to form an equation just in the other, and hence conclude that that must be zero.

For the general case, observe that we may always reduce an index $j \in [2,\dots,k-1]$ via
$$
f(a_{j-1}) - f(a_{k-1}) = (a_{j-1} - a_{k-1})f'(\xi_j),
$$
i.e.
$$ 
a_j = (a_{j-1} - a_{k-1})f'(\xi_j).
$$
Also,
$$
f(a_k) - f(a_{k-1}) = (a_k - a_{k-1})f'(\zeta),
$$
i.e.
$$ 
a_1 = - a_{k-1}f'(\zeta).
$$
This allows us to reduce to an equation in $a_1$: use the base case as a guide in how to conclude. (You may want to try $k=4, 5$ to see if you have the idea.)
