Let us write the fundamental equation of dynamics for all the three blocks in terms of projections, having taken the positive direction of $x$ and $y$ axes as shown in Fig; and using the fact that kinematical relation between the accelerations is such that the blocks move with same value of acceleration (say $w$ )
As the block $m_{0}$ moves down with acceleration $w$, so in vector form