The optimality of some tests for medians