Prime Factorization of the Greatest Common Divisor

Prove that
\[
\gcd(n,m)
= p_1^{\min(a_1,b_1)}p_2^{\min(a_2,b_2)}\cdots p_r^{\min(a_r,b_r)},
\]
given that $n$ and $m$ are positive integers with
\[
\begin{aligned}
n &= p_1^{a_1}p_2^{a_2}\cdots p_r^{a_r},\\
m &= p_1^{b_1}p_2^{b_2}\cdots p_r^{b_r},
\end{aligned}
\]
where $p_1,\ldots,p_r$ are distinct primes given by the Fundamental Theorem of Arithmetic and $a_i,b_i$ are nonnegative integers.

Solutions