Percolation solution :optimization: to have single start and end nodes on behalf of first and last rows