median line realization on sort