Mechanism of the degradation of polyamides