Function to find MEX of each subtree of tree
void solve ( int A , vector < int > C ) { int n = A ; vector < int > tree [ n + 1 ] ; for ( auto i : edges ) { tree [ i [ 0 ] ] . push_back ( i [ 1 ] ) ; tree [ i [ 1 ] ] . push_back ( i [ 0 ] ) ; } vector < int > sol ( n , 0 ) ;