5. Divide the natural numbers from 1 to 30 into two groups, such that the product of all numbers in the first group $A$ is divisible by the product of all numbers in the second group $B$. Then the minimum value of $\frac{A}{B}$ is ( ).
(A) 1077205
(B) 1077207
(C) 1077209
(D) 1077211
5. A.
$$
\begin{array}{l}
\text { Given } A B=30 \times 29 \times \cdots \times 1 . \\
=2^{26} \times 3^{14} \times 5^{7} \times 7^{4} \times 11^{2} \times 13^{2} \times \\
17 \times 19 \times 23 \times 29 .
\end{array}
$$

Let $C=2^{13} \times 3^{7} \times 5^{4} \times 7^{2} \times 11 \times 13 \times 17 \times 19 \times 29$.
Since $B \mid A$, we know $C \mid A$.
Thus $\left(\frac{A}{B}\right)_{\min }=5 \times 17 \times 19 \times 23 \times 29=1077205$.
When $A=C=30 \times 29 \times \cdots \times 19 \times 17 \times 12 \times 2$,

$\frac{A}{B}$ reaches its minimum value.