Machine starts to the right, by critelli.

Feel free to skip if the mechanism is obvious.

Inspired by a lock/key. For terminology sake, the 3 atom input will be referred to as the needle, and the 6 atom input will be the haystack.

Both inputs are converted to another form where each atom is represented by a backbone with 6 bits. The haystack has an extra gold/salt on the front of the backbone which we'll circle back to later.

The first 4 bits represent each elemental. The needle negates these bits. Bit 5 is only on the haystack. Bit 6 is only on the needle.  

When compared (at the mass bonding site) the two will always bond unless they are an exact match.  If they don't bond, the haystack is shifted so that bits 5/6 will always bond on a future bond check.

After making 4 comparisons, if the haystack had ever been shifted, the gold/salt at the front of the backbone will index the correct output.