a city represent bidirectional connect graph n vertex vertex label 1 n inclusive the edge graph represent 2D integer array edge edgesi ui vi denote bidirectional edge vertex ui vertex vi every vertex pair connect edge vertex edge the time take traverse edge time minutesEach vertex traffic signal change color green red vice versa change minute all signal change time you enter vertex time leave vertex signal green you wait vertex signal greenthe second minimum value define small value strictly large minimum valuefor example second minimum value 2 3 4 3 second minimum value 2 2 4 4given n edge time change return second minimum time vertex 1 vertex nnotesyou vertex number time include 1 nYou assume journey start signal turn green Example 1input n 5 edge 1213143445 time 3 change 5output 13explanationthe figure leave show give graphThe blue path figure right minimum time pathThe time take Start 1 time elapsed0 1 4 3 minute time elapsed3 4 5 3 minute time elapsed6hence minimum time need 6 minutesthe red path show path second minimum time Start 1 time elapsed0 1 3 3 minute time elapsed3 3 4 3 minute time elapsed6 wait 4 4 minute time elapsed10 4 5 3 minute time elapsed13hence second minimum time 13 minute Example 2input n 2 edge 12 time 3 change 2output 11explanationthe minimum time path 1 2 time 3 minutesthe second minimum time path 1 2 1 2 time 11 minute Constraints2 n 104n 1 edgeslength min2 104 n n 1 2edgesilength 21 ui vi nui vithere duplicate edgeseach vertex reach directly indirectly vertex1 time change 103