Sort statements related to flags.