prints shortest paths