Lets say you start with premium petrol, you run your load through the line and then you switch to ordinary grade - you start feeding that in. Sure there is a small amount of transitory petrol that isn't premium and is above normal, we call that the "cut" and downgrade it to the lower quality fuel.
You then follow next with some kero-heating oil, downgrading the cut into the diesel, and from that work back into different diesels, always downgrading the cut...... the trick is to minimise the cut as much as possible.