As shown in the figure, a body of mass m1 is located on a frictionless flat table. Consider that the ropes are inextensible and of negligible mass. The system is initially at rest, and pulley A is movable and massless.

I need to know where do the forces tension and mg point to for every body.
a) Write the Newton's equations for both masses and the constraint condition that relates their positions.
b) When the system begins to move, state what the relationship between the distances d1 and d2 traveled by m1 and m2 must be (constraint condition).
c) Find the acceleration of each mass and the tensions in the ropes as a function of m1, m2, and g.