Support the sorting starting with leaf