Rearrange the codes