The first line of the input contains two integersand
— the number of vertices and queries.
Thenlines follow, each line contains two integers
, representing an undirected edge between vertices
and
.
Thenlines follow, each line contains three integers
,
and
![]()
, query the minimum value of
.
The output haslines, each line contains an integer, representing the answer of the query.