Utility function to print the original indices of the elements of the array
function printIndices ( n , a ) { for ( var i = 0 ; i < n ; i ++ ) document . write ( a [ i ] [ 1 ] + " " ) ; document . write ( " " ) ; }