ComponentInstances touching

I have two cubes (componentinstances) that are in contact planes. How to identify which planes(faces) are in contact?

One way is to make them Gluing components, and then you can use their glued_to property.

Also, you can ask a face to get_glued_instances which returns an array.