Topologically faithful multi-class segmentation in medical images