if (y === T.root) {
setNodeColor(x, NodeColor.Black);
z.detach();
resetSentinel();
recomputeMaxEnd(x);
T.root.parent = SENTINEL;
return;
}
const yWasRed = (getNodeColor(y) === NodeColor.Red);