2. Given that $q$ is a real number, person A has a napkin with 10 different real numbers written on it. He writes three rows of real numbers on the blackboard in the following way:

The first row, A writes each number of the form $a-b$, where $a$ and $b$ are numbers from the napkin (they can be the same); The second row, A writes each number of the form $q a b$, where $a$ and $b$ are two numbers from the first row (they can be the same); The third row, A writes each number of the form $a^{2}+b^{2}-c^{2}-d^{2}$, where $a$, $b$, $c$, and $d$ are four numbers from the first row (they can be the same). Find all real numbers $q$ such that, regardless of what numbers are on the napkin, every number in the second row is also a number in the third row.
2. $q=-2,0,2$.

If each number in the second row unconditionally belongs to the third row, then $q$ is called "good".
First, prove: $0, \pm 2$ are good.
Since the third row must include 0, 0 is good.
For any two numbers $a, b$ in the first row, let
$$
a=x-y, b=u-v,
$$

where $x, y, u, v$ are numbers written on the napkin (which can be the same), then
$$
\begin{array}{l}
2 a b=2(x-y)(u-v) \\
=(x-v)^{2}+(y-u)^{2}-(x-u)^{2}-(y-v)^{2} .
\end{array}
$$

This shows that 2 is good.
Multiplying both sides of equation (1) by -1, we know that -2 is also good.
Next, prove: $-2, 0, 2$ are the only three good numbers.
Assume $q$ is a good number, and $q \notin\{-2,0,2\}$.
Consider 10 special numbers on the napkin. Let the 10 numbers on the napkin be integers $1,2, \cdots, 10$. Then the numbers in the first row are integers $-9,-8, \cdots,-1,0,1,2, \cdots, 9$.
Thus, the second row includes $q$ and $81 q$.
Therefore, the third row also includes these two numbers.
Since the numbers in the third row are all integers, $q$ is an integer.
Because the third row does not include integers greater than
$$
162=9^{2}+9^{2}-0^{2}-0^{2}
$$

or less than -162, we have
$$
-162 \leqslant 81 q \leqslant 162 \text {. }
$$

This indicates that $q= \pm 1$.
If $q= \pm 1$, let the 10 numbers on the napkin be 0,1, $4,8,12,16,20,24,28,32$. Then the first row includes $\pm 1$ and $\pm 4$. Thus, the second row includes $\pm 4$.
Since each number $a$ in the first row satisfies
$$
a \neq 2(\bmod 4),
$$

we have $a^{2} \equiv 0,1(\bmod 8)$.
Therefore, each number in the third row has a remainder of $-2, -1, 0, 1$, or 2 when divided by 8. In particular, $\pm 4$ cannot appear in the third row. This is a contradiction.