a2 - state generation + sort