To find the constraint relation between accelerations of blocks measure their distances from the fixed pulleys. Apply Newton’s second law in vertical direction for each block.
Let a, b and c be the respective accelerations of masses A (8 kg), B (4 kg), and C (16 kg) such that a and b are downward and c is upward. Let x1 and x2 be the distances of strings from axial line passing through P and Q to the blocks A and B, respectively. Let x3 be the length of the string from the axial line PQ to the center of the movable pulley. If L is the length of the string, then the constraint relation gives

As tension T is equal in all the strings as it passes over smooth pulleys, equations for the strings are as follows:

∴ 16 kg and 8 kg go downward and 4 kg go upward.