Answer: a = 4.9 m/s$^2$, T = 58.5 N

When the bodies are released, the heavier one moves downward and the lighter one moves upward.

Net force in the direction of motion of $m_1$ is $F_1 = m_1g - T$ which is equal to $m_1a$ as per Newton's second law.

$\Rightarrow m_1g - T = m_1 a \quad (i)$

Net force in the direction of motion of $m_2$ is $F_2 = T-m_2g $ which is equal to $m_2a$ as per Newton's second law.

$\Rightarrow T-m_2g = m_2a \quad (ii) $

Solving $(i)$ and $(ii)$ for acceleration, $a \rightarrow a = \large\frac{m_1-m_2}{m_1+m_2}$$g$

Substituting in $(ii)$, we get $T = m_2 (a+g) = m_2 (g \large\frac{m_1-m_2}{m_1+m_2}$$ + g)$

$\Rightarrow a = \large\frac{12-4}{12+4}$$9.8 = 4.9 m/s^2$

$\Rightarrow T = gm_2 \large\frac{m_1 - m_2 + m_1 + m_2}{m_1+m_2}$$ = \large\frac{2m_1m_2}{m_1+m_2}$$g$

$\Rightarrow T = \large\frac{2 \times 4 \times 12}{12 + 4}$$ 9.8 = 58.8 N$