Driver code
public static void main ( String [ ] args ) { n = 4 ; m = 5 ; s = new Stack < > ( ) ; adj = new ArrayList < > ( ) ; tsort = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) adj . add ( new ArrayList < > ( ) ) ;