Pergunta de entrevista da empresa Booking.com

circular dependencies data structure question. we need to show the element from starting to end