TikTok Interview Question

Circular Printer superstack ancestor problem