The Median Principle for Inequalities and Applications