In many countries, schools have responded to the COVID-19 pandemic by splitting up classes. While the purpose of dividing classes is clearly health-related, the process of doing so poses an interesting question: what is the best way to divide a class so as to maximize the incentive for students to perform better? Using a constructive example, we demonstrate how social-psychological unhappiness can be the basis for an incentive structure that optimally nudges students to improve their performance. The example is based on evidence that students aspire to improve their performance when it lags behind that of other students with whom they naturally compare themselves. For a given set of m students, we quantify unhappiness by the index of relative deprivation, which measures the extent to which a student lags behind other students in the set who are doing better than him. We examine how to divide the set into an exogenously predetermined number of subsets in order to maximize aggregate relative deprivation, so that the incentive for the students to study harder because of unfavorable comparison with other students is at its strongest. We show that the solution to this problem depends only on the students' ordinally-measured levels of performance, independent of the performance of comparators. In addition, we find that when m is an even number, there are multiple optimal divisions, whereas when m is an odd number, there is only one optimal division.