There are three kids and each one have some pencils. The first kid gave the second and third as many pencils as they each already had. Then, the second gave the first and third as many as they each had. Still later, the third gave the first and second as many as they each already had. Each kid now have 24 pencils.

How many pencils did each kid have originally?