Three perfect gases at absolute temperatures, $T_{1}, T_{2}$, and $T_{3}$, are mixed. The masses of molecules are $m_{1}, m_{2}$, and $m_{3}$ and the number of molecules are $n_{1}, n_{2}$, and $n_{3}$, respectively. Assuming no loss of energy, the final temperature of the mixture is [2011]
(A) $\frac{\left(T_{1}+T_{2}+T_{3}\right)}{3}$
(B) $\frac{n_{1} T_{1}+n_{2} T_{2}+n_{3} T_{3}}{n_{1}+n_{2}+n_{3}}$
(C) $\frac{n_{1} T_{1}^{2}+n_{2} T_{2}^{2}+n_{3} T_{3}^{3}}{n_{1} T_{1}+n_{2} T_{2}+n_{3} T_{3}}$
(D) $\frac{n_{1}^{2} T_{1}^{2}+n_{2}^{2} T_{2}^{2}+n_{3}^{3} T_{3}^{3}}{n_{1} T_{1}+n_{2} T_{2}+n_{3} T_{3}}$