Traverse the array
for ( let i = 1 ; i < N ; i ++ ) { let b = arr [ i - 1 ] [ 1 ] ; let d = arr [ i ] [ 1 ] ; if ( b > d ) { console . log ( " " + arr [ i - 1 ] [ 0 ] + " " + b + " " + arr [ i ] [ 0 ] + " " + d + " " ) ; return ; } }