Tolik Ryzhkov is a simple fourth-grader from Leningrad, who, however, is not alien to negative features of character – laziness, dishonesty, boasting and vanity. Once Tolik violates the rules of traffic and, running away from the policeman, he accidentally gets into a strange yard, from which there is no way out. In the middle of the yard there is a small building in which Tolik meets a strange boy with cold blue eyes, scrupulously counting boxes with matches. Tolik, trying to attract his attention, accidentally takes one of them, to which the boy unexpectedly reacts aggressively and Tolik, frightened, somehow escapes from the building and from the mysterious court. After a while he learns that the boxes are magic and if you break a match and make a wish, it is immediately executed. Tolik begins to create various small miracles, but because of them his whole life goes awry, he quarrels with his best friend Mishka Pavlov (but later reconciles with him), and all the people around him can no longer communicate with him the same way as before. In the end, he does not know how to overcome that tangle of problems that was formed as a result of the thoughtless execution of all his desires, but the worst is ahead – a strange boy with blue eyes, who turns out to be a Wizard, suddenly appears before him. He is very angry with Tolia for the stupidity of his desires and declares that he takes it with him. Accidentally, the Mage “with a hot hand”
Tolik comes to his senses in the hall of a building, which later recognizes the Palace of Pioneers. Going outside, he finds next to several buildings, one of which is Gostiny Dvor. Simultaneously, Tolik encounters the metal humanoid robot Goebbes. From him and from the then appeared Wizard, Tolik learns that he is on an island located in a certain parallel dimension, which is called Yesterday’s Day. The island is completely packed with various entertainments and pleasures, in the form of attractions, restaurants and shops, but the only people on the island are the Wizard, Tolik and Mishka, not counting Maida and Balbes. The wizard announces to Tolik that he must forget Mishka, because Mishka is no longer his friend, his friend is the Wizard, and he can give Tolik much of what Mishka can not give him (of course, due to the matches). The wizard also explains to Tolik that he at one time liked him because of all the negative qualities of his character, namely, envy and flattery, because the Wizard believes that his friend should be the one who will envy him all the time (after all with magical with matches he can wish anything, anything). Since the Wizard does not control Tolik’s movement around the island, the boy begins an independent walk in an attempt to find Mishka. Silently, Balbes accompanies him, in which, as Tolik finds out, only one program has been put in place: Tolik can go where he wants and do what he wants, but he can not go to where they keep Mishka. who will envy him all the time (after all, with magic matches he can wish anything, anything). Since the Wizard does not control Tolik’s movement around the island, the boy begins an independent walk in an attempt to find Mishka. Silently, Balbes accompanies him, in which, as Tolik finds out, only one program has been put in place: Tolik can go where he wants and do what he wants, but he can not go to where they keep Mishka. who will envy him all the time (after all, with magic matches he can wish anything, anything). Since the Wizard does not control Tolik’s movement around the island, the boy begins an independent walk in an attempt to find Mishka. Silently, Balbes accompanies him, in which, as Tolik finds out, only one program has been put in place: Tolik can go where he wants and do what he wants, but he can not go to where they keep Mishka.
Exploring the island, Tolik notices a lot of nonsense in the blessings that conjured the Sorcerer: in the park, the footpath moves itself and in any direction where Tolik wants to go; on the beach there is a whole row of fishing rods, but fishing is useless, because the fish itself is ready to jump ashore; swimming does not make sense, because it’s impossible to drown in the water of Yesterday’s Day; and when Tolik comes to the pier, then all the boats standing there are on their own. Meanwhile, Mishka is imprisoned in a room on one of the upper floors in a tall building on the shore. From his window, looking at the ocean, he notices that the horizon line is very close to the shore, as if the water surface is being cut off somewhere. Every time the Wizard enters his room, he makes a wish that Mishka and Maida can not cause him any damage. The wizard demands from Mishka, so that he apologizes to him and even promises in that case to let him go home, but Mishka refuses. First, he is not going to throw Tolik (although the Wizard tries to convince him that Tolik has long been indifferent to him), and secondly, he feels that the Sorcerer is lying and will not let him go anywhere.
Tolik sits on one of the boats and decides to leave the island. After some distance Balbes states that Tolik can not swim further, and tries to tear his hands from the helm. Tolik screams in pain and Balbes unexpectedly releases him. Realizing that Balbes is programmed to not cause any pain to Tolik, Tolik begins to say non-stop, that he is very hurt, so the boat swims forward. After a while, Tolik begins to notice a strange swelling of water ahead, and then his city appears from the void for a while, but then the motor boat gives a car back and takes Tolik to the Wizard. The wizard persistently asks Tolik what he saw, and Tolik, suspecting something wrong, is lying that he has not seen anything. The same evening the Wizard comes to Mishka and, unable to restrain himself, reveals to him the secret: the world of Yesterday’s Day is separated from reality by some Dash; if you swim to the Devil at sunset, you can see the city, and if you swim at dawn, you can swim for the Devil. A little later at night, Toliku, depicting the pain in words, manages to learn from Balbes, where Mishka is. With the help of a robot, he climbs into a friend’s room and helps him and Maida go down from there on the rope.
Bubbes, who all the time follows Tolik, instead of using the rope, just walks through the windowsill, falls to the ground and in it something breaks. Friends run to the pier, but then the Wizard wakes up and notices them. Since the Wizard does not have matches with him, Tolik, despite the fact that the Wizard is older than him, manages to twist the latter, since he, being very dependent on matches, is physically very weak, and lock him in the restroom. He, Mishka and Maida, board one of the boats and sail to the Devil. The broken Balbes slowly follows Tolik, enters the water and gradually disappears in the depths. Having swum up to the Devil, the boat sails forward this time, but when his nose passes the Devil, he suddenly swims back – the Wizard free himself. Tolik, Mishka and Maida then jump overboard, hitting the Devil.
They are right in the middle of the carriageway on a busy street, appearing from nowhere. Joy from the return of Tolik does not feel, because he sees around a bunch of consequences of his desires. In particular, his mother does not scold him for the mysterious disappearance (their absence did not pass unnoticed), as early Tolik made a wish that his mother would allow him everything. And although he does not already have a box with magic matches and he can not fix anything, accidentally Tolik finds a single match that fell out of the box before, and breaks it, making a wish that in his life, his parents and friends, as before, which is what happens. The book ends with an afterword in which the author writes that the Wizard still lives in Yesterday’s Day (and at any moment can return to reality to find himself a new friend and take revenge on Tolik)