The Perturbed Median Principle for Integral Inequalities with Applications