hint:

Find the center of mass of each of the cubes and then treat them as point particles of equal mass.