  Let $K$ be a field of characteristic zero, $K[x,y]$ be the polynomial ring in
two variables. Let $\phi=(f, g)$ be an endomorphism of $K[x,y]$. It is proved
that if $\phi$ maps each coordinate to a generator of some proper retract, then
it is an automorphism. As a corollary, the retract preserving problem is solved
for both polynomial ring over $K$ and free algebra over an arbitrary field when
$n=2$.
