Matthew wants to bring in treats for his class for his birthday. He decided to bring in 24 candy corn and 40 skittles. He wants to make bags for his class so that each bag is identical. He must use all the candy he brought in. What is the greatest amount of bags that he can make? How many candy corn and skittles are in each bag?