Question d’entretien chez X

The problem is a quite usual one with BFS algorithm.