How to find the median class?