22. Let $S$ be the set of all non-zero real-valued functions $f$ defined on the set of all real numbers such that
$$
\mathrm{f}\left(x^{2}+y f(z)\right)=x \mathrm{f}(x)+z \mathrm{f}(y)
$$
for all real numbers $x, y$ and $z$. Find the maximum value of $\mathrm{f}(12345)$, where $\mathrm{f} \in S$.
22. Answer: 12345
We are given the equation
$$
\mathrm{f}\left(x^{2}+y f(z)\right)=x f(x)+z f(y) .
$$

Substituting $x=y=0$ into (1), we get $z \mathrm{f}(0)=\mathrm{f}(0)$ for all real number $z$. Hence $\mathrm{f}(0)=0$. Substituting $y=0$ into (1), we get
$$
\mathrm{f}\left(x^{2}\right)=x \mathrm{f}(x)
$$

Similarly, substituting $x=0$ in (1) we get
$$
\mathrm{f}(y \mathrm{f}(z))=z \mathrm{f}(y) .
$$

Substituting $y=1$ into (3) we get
$$
\mathrm{f}(\mathrm{f}(z))=z \mathrm{f}(1)
$$
for all real $z$. Now, using (2) and (4), we obtain
$$
f(x f(x))=f\left(f\left(x^{2}\right)\right)=x^{2} f(1) .
$$

Substituting $y=z=x$ into (3) also yields
$$
\mathrm{f}(x \mathrm{f}(x))=x \mathrm{f}(x) .
$$

Comparing (5) and (6), it follows that $x^{2} \mathrm{f}(1)=x \mathrm{f}(x)$, so that if $x$ is non-zero, then $\mathrm{f}(x)=c x$ for some constant $c$. Since $\mathrm{f}(0)=0$, we also have $\mathrm{f}(x)=c x$ for all real values of $x$. Substituting this into (1), we have that $c\left(x^{2}+c y z\right)=c x^{2}+c y z$. This implies that $c^{2}=c$, forcing $c=0$ or $c=1$. Since $f$ is non-zero, we must have $c=1$, so that $\mathrm{f}(x)=x$ for all real values of $x$. Hence $f(12345)=12345$.