sort classes as required by exercise