Building the tree
List < int > [ ] tree = new List < int > [ N + 1 ] ; for ( int i = 0 ; i < tree . Length ; i ++ ) tree [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < E ; i ++ ) { addEdge ( tree , edges [ i , 0 ] , edges [ i , 1 ] ) ; }