Cogsets are phased: the rotational offset of the cogs is finely tuned to the horizontal distance and the difference in tooth count so that the chain fits across the gap.
The phase has to relative to other cogs but also relative to the mounting splines.
If you swap out one cog for another of the same tooth count but a different phase (relative to the splines) it wont work.