2. Polynomial $f(x)=x^{2}+p x+q$ when divided by polynomial $g_{1}(x)=x-1$ gives a remainder

(8) 6, and when divided by $g_{2}(x)=x-2$ the remainder is 12. Determine the polynomial $f(x)$.
First solution. By dividing the polynomial $f(x)$ by the polynomial $g_{1}(x)$, the remainder is $p+q+1$:

$$
\begin{array}{ll}
\left(x^{2}+p x+q\right) & :(x-1)=x+p+1 \\
\frac{-x^{2}+x}{(p+1) x}+q \\
\frac{-(p+1) x+(p+1)}{p+q+1}
\end{array}
$$

By dividing the polynomial $f(x)$ by the polynomial $g_{2}(x)$, the remainder is $2 p+q+4$:

$$
\begin{aligned}
& \left(x^{2}+p x+q\right) \quad:(x-2)=x+p+2 \\
& \frac{-x^{2}+2 x}{(p+2) x+q} \\
& \frac{-(p+2) x+(p+2)}{2 p+q+4}
\end{aligned}
$$

We obtain a system of two equations with two unknowns:

$$
\left.\begin{array}{rl}
p+q+1 & =6 \\
2 p+q+4 & =12
\end{array}\right\}(*)
$$

The solutions to this system are $p=3, q=2$.

The desired polynomial is $f(x)=x^{2}+3 x+2$.

(full solution 8 points)

(at least one of the equations in the system (*) 4 points)