Two gym classes are participating in Field Day. One class has 24 students and the other has 27 students. The gym teachers want to divide the students in each class into the largest possible equal groups, with no students left over. If all the groups have the same number of students, how many students are in each group?