There were 54 apples set aside as a snack for 3 classes of students. The teachers divided up the apples and placed equal amounts on 9 separate trays. If each of the 3 classes received the same number of trays, how many apples did each class get?