Maximum number of nodes is 100000 and nodes are numbered from 1 to 100000
let MAXN = 100001 ; let tree = new Array ( MAXN ) ; let path = new Array ( 3 ) ; for ( let i = 0 ; i < 3 ; i ++ ) { path [ i ] = new Array ( MAXN ) ; for ( let j = 0 ; j < MAXN ; j ++ ) { path [ i ] [ j ] = 0 ; } } let flag ;