612 * Find a polynomial $f(x)$ such that
$$
x^{2}+1 \mid f(x) \text { and } x^{3}+x^{2}+1 \mid f(x)+1 \text {. }
$$
Let $f(x)=\left(x^{2}+1\right) u(x), f(x)+1=\left(x^{3}+x^{2}+1\right) v(x)$, then
$$
\left(x^{3}+x^{2}+1\right) v(x)-\left(x^{2}+1\right) u(x)=1 \text {. }
$$

To find $u(x)$ and $v(x)$ that satisfy (1), we perform the Euclidean algorithm on $x^{3}+x^{2}+1$ and $x^{2}+1$:
$$
x^{3}+x^{2}+1=\left(x^{2}+1\right)(x+1)-x, x^{2}+1=x \cdot x+1 \text {. }
$$

Thus, we have
$$
\begin{aligned}
1 & =\left(x^{2}+1\right)-x \cdot x \\
& =\left(x^{2}+1\right)+x\left(\left(x^{3}+x^{2}+1\right)-\left(x^{2}+1\right)(x+1)\right) \\
& =x\left(x^{3}+x^{2}+1\right)-\left(x^{2}+x-1\right)\left(x^{2}+1\right) .
\end{aligned}
$$

Therefore, let $v(x)=x, u(x)=x^{2}+x-1$, then (1) holds.
The required $f(x)=\left(x^{3}+x^{2}+1\right) x-1=x^{4}+x^{3}+x-1$.