9 is a sentient rag doll who appears to be the scientist last creation and the last of his kind, living in the ruins of a decaying, post-apocalyptic Earth. He is first seen making simple constructs out of refuse – a swinging armature of scrap metal, an upright book with string tied around it, and a dummy rag doll full of tar, though the purpose behind these things is unclear at first. Hunting 9 relentlessly is the Cat Beast, a mechanical monster wearing a cat's skull for a head. It appears to be guided by a small glowing talisman which it holds in its claws. Sitting quietly, 9 stares into the mirrored surface of his own strange talisman and has a flashback.
In the flashback, 9 searches the ruins with his mentor 5, a one-eyed rag doll. They gather useful bits and pieces and store them in the cloth linings of their own skin. With 9's help, 5 is able to salvage a light bulb and operate it using pieces of wire. 5 gives the functional bulb to 9 for safe-keeping.
Almost immediately after, 5 draws the mirrored talisman from inside his chest. It glows green, warning of danger. 5 gives the talisman to 9 then pushes him into cover. Extending a homemade folding spear, 5 steps out to confront the threat. But the Cat Beast circles behind him and snatches him up with a metal pincer, shearing off his right arm. Though he struggles, 5 can not break free, and the Cat Beast sucks 5's soul out through his mouth using its talisman leaving 5 lifeless. Horrified, 9 escapes in panic, almost giving away his location to the Cat Beast by scraping the light bulb against a rock.
9 is woken from the memory by the warning green glow of the mirrored talisman. Taking the light bulb, which he has attached to the end of a staff, 9 flees into a ruined house. The Cat Beast follows and we see that it has not just taken the other rag dolls' souls: it also wears their numbered skins like a garment. The number 5 shows prominently on its back.
The Beast pounces on what it thinks is 9, but which turns out to be a marionette – the dummy created by 9 at the beginning of the film. The Beast's claws stick in the tar and 9 is able to hop onto its back and steal the Beast's talisman. 9 leads the Beast on a panicked chase through the house and finally runs out onto the end of a broken plank, which extends over a several-story drop. Thinking it has 9 cornered, the Beast walks out onto the plank. But it has fallen into 9's trap.
Nearby is the metal armature, and the upright book. 9 leaps off the plank onto the armature, which swings him around to the book. He kicks it and it falls into the pit. The string, tied at one end to the book, has its other end tied to the plank. The weight of the falling book drags the plank into the pit, and the Beast with it. The Beast crashes through a hole in the cellar floor and is presumably impaled by the sharp end of the falling plank. This all reveals that all the things that 9 has built was a cleverly made trap for the Beast.
Now free from fear, 9 salvages the skins of the other rag dolls and prepares them to be ceremonially burned. As he looks sadly at the skin of 5, the two talismans begin to glow. 9 realizes that they are two halves of a whole and puts them together. A beam of green light erupts from the united talisman, and the spirits of the eight slain rag dolls 1, 2, 3, 4, 5, 6, 7 and 8 emerge, returning to their rag doll skins to be at peace. Before disappearing, 5's soul turns to 9 and nods in approval.
In the morning, when the ashes have cooled, 9 – bearing the light bulb staff, a symbol of the persistent light of knowledge and learning – walks off into the wasteland, leaving the empty talisman behind in the sand.

Question: What does 5 give to 9 for safe-keeping?
Answer: A light bulb.