The factorisation of the alternating and symmetric groups