Pergunta de entrevista da empresa Google

Asked me graph question about finding ancestors