all problem contest share statement difference test solution run for information scoring refer scoring section statementThis interactive problemimagine treasure hunter skillful one day come ancient map help rich the map show multiple forestry road junction treasure so start journey hope retrieve hide treasure do not know wicked wizard standing craving tangle road impede achievementsthe treasure map represent undirected graph vertex correspond junction edge correspond road your path begin certain fix vertex label know every time come vertex dig treasure chest flag vertex at initial vertex you ll find treasure chest immediately consequently you ll flag immediately wellwhen stand junction adjacent vertex degree flag there thing besides power wicke wizard great able change location road junction map change graph structure therefore sequence road come junction v different time come junction v however mind set adjacent crossroad change aware previously dig treasure adjacent v vertexyour goal collect treasure vertex graph fast good luck hunt