3. Given a sequence of positive terms $\left\{a_{n}\right\}$ with the first term being 1, and for all positive integers $n$, we have
$$
a_{n}\left(n a_{n}-a_{n+1}\right)=(n+1) a_{n+1}^{2} \text {. }
$$

Then $a_{n}=$ . $\qquad$