Answer
Please see the work below.
Work Step by Step
We know that
$F-T-m_1g=m_1a$
This simplifies to:
$m_1=\frac{F-T}{a+g}=\frac{30-18}{9.8+3.2}=0.92Kg$
For the other mass
$T-m_2g=m_2a$
This simplifies to:
$m_2=\frac{T}{g+a}$
$m_2=\frac{18}{9.8+3.2}=1.4Kg$