you give integer n denote number city country the city number 0 n 1you give 2D integer array road roadsi ai bi denote exist bidirectional road connect city ai biyou need assign city integer value 1 n value the importance road define sum value city connectsreturn maximum total importance road possible assign value optimally Example 1input n 5 road 011223021324output 43explanation the figure show country assign value 24531 the road 01 importance 2 4 6 the road 12 importance 4 5 9 the road 23 importance 5 3 8 the road 02 importance 2 5 7 the road 13 importance 4 3 7 the road 24 importance 5 1 6the total importance road 6 9 8 7 7 6 43it show obtain great total importance 43example 2input n 5 road 032413output 20explanation the figure show country assign value 43251 the road 03 importance 4 5 9 the road 24 importance 2 1 3 the road 13 importance 3 5 8the total importance road 9 3 8 20it show obtain great total importance 20 Constraints2 n 5 1041 roadslength 5 104roadsilength 20 ai bi n 1ai biThere duplicate road