How to allocate classes to students?