6. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=1$, and $S_{n}=n^{2} a_{n}$, $a_{n}$ is a ( ) of $n$.
A. Linear function
B. Quadratic function
C. Exponential function
D. Rational function
6. D.

Given $S_{n}=n^{2} a_{n}$, we also have $S_{n-1}=(n-1)^{2} a_{n-1}$. Subtracting the two equations yields $(n+1) a_{n}=(n-1) a_{n-1}$. Multiplying both sides by $n$ gives $(n+1) \cdot n a_{n}=n(n-1) a_{n-1}$, so we get $(n+1) n a_{n}=(1+1) \cdot 1 a_{1}=1$. Therefore, $a_{n}=\frac{1}{n(n+1)}$.