Start off with your "top" cube. Found out what objects it touches. Then for each of those objects, find what they touch. Do this over and over until you run out of options, or one of the object touches the ground. You'll need to keep a list of what objects you've already tested, since, if A touches B, then when you look at B it'll touch A, and you don't want to check A again.
↧