The torques exerted by the opposing blocks must cancel. Torque is equal to force times the radial distance (the distance between the location of the applied force and the point of rotation).
The torque exerted by the stationary 23N block is (23 N) * (80 cm - 50 cm) = 690 N*cm. Therefore, we must cancel that torque out on the opposite side of the center of gravity (point of rotation) with the other block.
If we use the 18N block, we need to place it at (18 N) * (x cm - 50 cm) = -690 N*cm. Solving for x, we get 11.67 cm.
If we use the 42N block, we need to place it at (42 N) * (x cm - 50 cm) = -690 N*cm. Solving for x, we get 33.57 cm.