Sorting states against CQ workflow