Undersampling is a minimax optimal robustness intervention in nonparametric classification