The Answer to the Question
is below this banner.
Here's the Solution to this Question
Assign each class to a time period. Then 677 different classes (pigeons) has to be assigned to 38 pigeonholes.
By the Pigeonhole Principle there exists a time period will have at least classes during it.
So different rooms will be needed.