Sort the substitution