Grammy is a puzzle master. Today, she is playing a variant of "Kurodoko" puzzle.
The puzzle consists of a graph with
nnn vertices and
mmm undirected edges. Each vertex has a clue value
aia_iai, and each edge has a length
lil_ili.
The goal is to find a spanning tree such that for each vertex, the distance to its furthest point on the spanning tree is exactly its clue value
aia_iai.

The left picture illustrates an empty puzzle, and the right picture shows a solution to the puzzle.
Grammy surely knows how to solve the puzzle, but she decided to give you a quiz. Please solve the puzzle.