Function to store and print all the valid paths
function printPath ( m , n ) { let visited = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) { visited [ i ] = new Array ( MAX ) ; for ( let j = 0 ; j < MAX ; j ++ ) visited [ i ] [ j ] = false ; }