Below is an instruction that describes a task. Write a response that appropriately completes the request in Swahili. Please answer in Swahili.

### Instruction:
Emily bought 9 packs of candy necklaces to give her classmates at school for Valentine’s Day. Each pack had 8 candy necklaces in it. Emily opened one pack at a time. After her classmates took as many as they wanted, there were 40 candy necklaces left. How many packs did Emily open for her classmates?

### Response:
 Mikufu ya pipi iliyosalia baada ya wenzake kuchukua = pakiti 9 * mikufu 8 ya pipi - mikufu 40 ya pipi = mikufu 40 ya pipi - mikufu 72 ya pipi = <<9*8-40=32>>mikufu 32 ya pipi.
Kwa kuwa kila pakiti ilikuwa na mikufu 8, hii inamaanisha kulikuwa na pakiti 32 / 8 = <<32/8=4>>pakiti 4 za mikufu ya pipi iliyosalia.