3. Person A and Person B go to a discount store to buy goods. It is known that both bought the same number of items, and the unit price of each item is only 8 yuan and 9 yuan. If the total amount spent by both on the goods is 172 yuan, then the number of items with a unit price of 9 yuan is $\qquad$ pieces.

Person A and Person B go to a discount store to buy goods,  
it is known that both bought  
the same number of items, and the unit price of each  
item is only 8 yuan and 9 yuan. If the total amount spent by both on the goods is  
172 yuan, then the number of items with a unit price of 9 yuan is $\qquad$ pieces.
3.12.

Suppose each person bought $n$ items, among which $x$ items cost 8 yuan each, and $y$ items cost 9 yuan each. Then we have
$$
\begin{array}{l}
\left\{\begin{array} { l } 
{ x + y = 2 n , } \\
{ 8 x + 9 y = 172 }
\end{array} \Rightarrow \left\{\begin{array}{l}
x=18 n-172, \\
y=172-16 n .
\end{array}\right.\right. \\
\because x \geqslant 0, y \geqslant 0, \therefore\left\{\begin{array}{l}
18 n-172 \geqslant 0, \\
172-16 n \geqslant 0 .
\end{array}\right.
\end{array}
$$

Solving, we get $9 \frac{5}{9} \leqslant n \leqslant 10 \frac{3}{4}$.
Thus, $n=10$. Therefore, $y=172-160=12$.