Formation of N-bridgehead 1,2,5-thiadiazolium and selenadiazolium rings through an intramolecular cyclisation reaction.