Function to add an edge to graph
static void addEdge ( Vector < Integer > adj [ ] , int u , int v ) { adj [ u ] . add ( v ) ; adj [ v ] . add ( u ) ; } static int cnt = 0 ; static boolean [ ] visited ;