12 (18 points) A school's math interest group consists of $m$ students, and the school has arranged $n$ teachers as advisors. During one of the group's activities, each pair of students asks each other a question, each student asks each advisor a question, and each advisor also poses a question to the entire group, with all these questions being distinct, resulting in a total of 51 questions. Try to find the values of $m$ and $n$.

---

The translation preserves the original text's formatting and structure.
12) From the problem, we have $m(m-1)+m n+n=51$. Simplifying, we get
$$
m^{2}+(n-1) m+n-51=0 \text {. }
$$

Therefore,
$$
\begin{aligned}
\Delta & =(n-1)^{2}-4(n-51) \\
& =n^{2}-6 n+205=(n-3)^{2}+196 .
\end{aligned}
$$

Since $m \in \mathbf{N}^{*}$, $\Delta$ must be a perfect square.
Let $(n-3)^{2}+196=k^{2}$ (where $k$ is a positive integer), then
$$
(n-3+k)(n-3-k)=-196 .
$$

Here, $n-3+k$ and $n-3-k$ have the same parity, and $n-3+k \geqslant n-3-k$, so
$$
\left\{\begin{array}{l}
n-3+k=2 \\
n-3-k=-98
\end{array}\right.
$$

or
$$
\left\{\begin{array}{l}
n-3+k=98 \\
n-3-k=-2
\end{array}\right.
$$

or
$$
\left\{\begin{array}{l}
n-3+k=14 \\
n-3-k=-14
\end{array}\right.
$$

From (1), we get $n=-45$ (discard).
From (2), we get $n=51$, at this time the original equation is $m^{2}+50 m=0$, solving we get $m_{1}=-50$, $m_{2}=0$ (discard).

From (3), we get $n=3$, at this time the original equation is $m^{2}+2 m-48=0$, solving we get $m_{1}=6$, $m_{2}=-8$ (discard).
Therefore, $m=6, n=3$.