12. From 30 people with distinct ages, select two groups, the first group consisting of 12 people, and the second group consisting of 15 people, such that the oldest person in the first group is younger than the youngest person in the second group. The number of ways to select these groups is. $\qquad$ .
12. 4060

Assume the ages of these 30 people, in ascending order, are $a_{1}<a_{2}<\cdots<a_{29}<a_{30}$. Let the first group of 12 people be $a_{i 1}<a_{i 2}<\cdots<a_{i 12}$, and the second group of 15 people be $a_{j 1}<a_{j 2}<\cdots a_{111}$, which are the ages of the selected two groups that meet the requirements. Thus, $a_{t 12}<a_{11}$.

In this way, this selection method corresponds one-to-one with $a_{t 1}<a_{i 2}<\cdots<a_{i 12}<a_{j 1}<\cdots<a_{11}$. The latter is a 27-element subset of $\mid a_{1}, a_{2}, \cdots, a_{30}!$.
Therefore, the number of selection methods is $C_{30}^{27}=C_{30}^{3}=4060$.