12. Let real numbers $x, y, z$ satisfy $xy \neq 0, x+y \neq 0$. Find
$$
\left(\frac{y+z}{x}+2\right)^{2}+\left(\frac{z}{y}+2\right)^{2}+\left(\frac{z}{x+y}-1\right)^{2}
$$

the minimum value.
12. Let $a=x+y+z, b=y+z, c=z$. Then
$$
\begin{array}{l}
\left(\frac{y+z}{x}+2\right)^{2}+\left(\frac{z}{y}+2\right)^{2}+\left(\frac{z}{x+y}-1\right)^{2} \\
=\left(\frac{a}{a-b}+1\right)^{2}+\left(\frac{b}{b-c}+1\right)^{2}+\left(\frac{c}{c-a}+1\right)^{2} \\
=\sum\left(\frac{a}{a-b}\right)^{2}+2 \sum\left(\frac{a}{a-b}\right)+3 \\
=\sum\left(\frac{a}{a-b}\right)^{2}+2\left[\sum\left(\frac{a}{a-b} \cdot \frac{b}{b-c}\right)+1\right]+3 \\
=\left(\sum \frac{a}{a-b}\right)^{2}+5 \geqslant 5,
\end{array}
$$

where “$\sum$” denotes the cyclic sum.
When $a=0, b=1, c=2$, i.e., $x=y=-1, z=2$, the equality holds.
Thus, the minimum value sought is 5.