Driver code
public static void main ( String [ ] args ) { int N = 6 ; ArrayList < ArrayList < Integer > > adj = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < ( int ) ( 1e5 ) ; i ++ ) { adj . add ( new ArrayList < Integer > ( ) ) ; }