C # program to implement the above approach
using System ; using System . Collections . Generic ; class GFG { static int mini = 105 , ans , n ; static List < int > [ ] g = new List < int > [ 100 ] ; static int [ ] size = new int [ 100 ] ;