Function to add an edge to the tree
void addEdge ( vector < pair < int , int > > & edges , list < int > * tree , int x , int y ) { edges . push_back ( { x , y } ) ; tree [ x ] . push_back ( y ) ; tree [ y ] . push_back ( x ) ; }