If the blocks are moving as shown in the figure the relation between a1 , a2 and a3 will be
2a1+2a2+a3=0
2a1−2a2+a3=0
2a1−2a2−a3=0
2a2−2a1+a3=0
From pulley (3)
a2=2a1−a322a2=2a1−a32a2−2a1+a3=0