There are 8 students and the maximum capacity of the cars together is 9.
We may divide the 8 students as follows
Case I: 5 students in the first car and 3 in the second Or
Case II: 4 students in the first car and 4 in the second
Hence, in Case I: 8 students are divided into groups of 5 and 3 in
ways.
Similarly, in Case II: 8 students are divided into two groups of 4 and 4 in
ways.
Therefore, the total number of ways in which 8 students can travel is
= 56 + 70 = 126.