pick the shortest path