Formation of imines and enamines