How do you freeze the water jets at the start of bubble blastoff on super mario galaxy?

First you need to use the cannon to get to the planet with the Fire Flower. Grab it, then head back and light all three torches in the cave. Doing so will make an Ice Flower appear. Use this to freeze the water jets.