Let $a$ be the common
acceleration of the system
$a = \frac{7 - 5}{7 +5} g = \frac{2}{12} g = \frac{1}{6}g$
The equation of motion of 3 kg mass is
$3g - T_2 = 3a$
or $T_2 = 3 g - 3 \left( \frac{g}{6} \right)$
or $T_2 = \frac{5g}{2} = \frac{5}{2} \times 9.8 N = 24.5 N$