Constraint Classification for Multiclass Classification and Ranking