Question on MST

" https://codeforces.com/contest/1133/problem/F2 "
logic ye lagaya ki:

  1. counted all bridges having vertex 1
  2. checked that “d” ke value kam se kam bridges ke equal ya greater hone chaheye and less than all_edges of node 1
  3. agar ye sab satisfy hore hai to fir remaining edges ko maine node 1 pe assign karna start kiya. . . agar assign hogye then YES agar nahi hopaye then NO
    JITNA maine check kiya logic me problem to nahi lagrahi . . . . . mera 37th testcase WA ara hai kyoki maine sare (child,parent) pair print nahi kiye. . . . . . .aur kon se miss hohye ye muje nahi pata chalra … . . . . . .MERA code just in case . . . . .“https://ideone.com/t7TNO6

@Eurus
Your approach seems great but unnecessarily complex
The editorial solution is very elegant
You can see it here
https://codeforces.com/blog/entry/65807