In the arrangement shown in fig neglect the masses of the pulley and string

In the arrangement shown in fig neglect the masses of the pulley and string and also friction. The accelerations of blocks A and B are
image

image
Free body diagrams for two mass blocks and two pulleys are given in figure.
Force balance equations for all the cases are given below
For m1 :- image
For m2 :- image
for pulley P1 :- 2 ×T - T = 0 × aP1 … (3)
for pulley P2 :- T2 - 2 ×T = 0 × aP2 …(4)
By solving Eqns. (1), (2), (3) and (4) , we get a1 = - g and a2 = g
Hence both blocks are moving downwards with acceleration g m/s2