This is not my code, just a port of this to codepen.
Drag to rearrange these nodes, then click Some nodes will be replaced.