All nearest smaller values problem