In the story, two clever, space-traveling robots (Trurl and Klapaucius) fall into the clutches of an evil robot, the giant piratePugg. This pirate does not want to rob them of gold or silver; instead, he wants information. Specifically, Pugg tells his two captives that he will forcibly hold them until they tell him everything they know.

Faced with the possibility of spending eons reciting all their knowledge, Trurl and Klapaucius offer the pirate a bargain. If he promises to let them go afterwards, the pair will build him a Demon of the Second Kind, a special machine that can print out an infinite amount of information.

The process is straightforward. In any gas, molecules are bumping into each other with trillions of collisions per second. Sometimes, they happen to arrange themselves in the shape of a letter. More rarely, they arrange themselves in the shape of a word. Rarer still, they arrange themselves to read out a statement. Some of these statements are true; some aren't. The specialty of a Demon of the Second Kind is that it can separate the false statements from the true, and given a roll of paper, it will write out the truth and forget the falsehood.

Pugg accepts the deal, and his captives place this Demon atop a small hole in an otherwise airtight drum. The Demon immediately prints out the facts it sees, and Pugg greedily reads the steadily advancing paper with his hundred eyes. Meanwhile, Trurl and Klapaucius run away as fast as they can, for they know what is about to happen. The Demon can separate fact from fiction, but it cannot separate the useful from the useless, and almost every fact it prints is good for absolutely nothing.