First, make them out of a shape that naturally fits together.
Then, build them with a vertical hole (shaft) through them. Put a reflector under the bottom one. Before the crane releases a block, it shines a light down the hole and checks if it is reflected back. Misalignment will block the light. (Or, you can do something similar with electricity, connected contacts on the top and bottom, and a check that current flows through the entire stack.)