12. Given $\log _{a} x+3 \log _{x} a-\log _{x} y=3(a>1)$.
(1) Let $x=a^{t}$, express $y$ in terms of $a, t$;
(2) If when $0<t \leqslant 2$, $y$ has a minimum value of 8, find $a$ and $x$.
12. (1) From the given conditions, we have $x>0, x \neq 1, y>0$. Substituting $x=a^{t}$ into the given conditions yields $t+\frac{3}{t}-$ $\frac{1}{t} \log _{a} y=3$, then $\log _{a} y=t^{2}-3 t+3, y=2^{t^{2}-3 t+3}$, where $a>1, t \in \mathbf{R}$ and $t \neq 0$ (since $x \neq 1$ );
(2) Since $a>1,01$, we have $y_{\text {min }}=a^{\frac{3}{4}}=8$. Thus, $a=16, x=a^{t}=64$.