Constrain one object to another, open the script editor, you should see something like this:
//Select first sphere
select -r pSphere1 ;
//Select second sphere
select -tgl pSphere2 ;
//Now create a point constrain with an offset of 0/0/0 and a weight of 1
pointConstraint -offset 0 0 0 -weight 1;
cut it, paste it into a text editor, make duplicates of your process, replace the objects names (sphere2 to sphere3, sphere4...), end up with one big master script, paste it back into the script editor, use the "Execute" command and, presto, there you are.