Junior high classes of 30 students each met in the cafeteria to take achievement tests. If exactly 5 students sat at each table and 24 tables were used, how many classes took the tests?