Early in the 21st century, nearly twenty years after the invention of atomic power and ten years after the first lunar landing, the four-man crew of the Ares has landed on Mars in the Mare Cimmerium. A week after the landing, Dick Jarvis, the ship's American chemist, sets out south in an auxiliary rocket to photograph the landscape. Eight hundred miles out, the engine on Jarvis' rocket gives out, and he crash-lands into one of the Thyle regions. Rather than sit and wait for rescue, Jarvis decides to walk back north to the Ares. Just after crossing into the Mare Chronium, Jarvis comes across a tentacled Martian creature attacking a large birdlike creature. He notices that the birdlike Martian is carrying a bag around its neck, and recognizing it as an intelligent being, saves it from the tentacled monstrosity. The rescued creature refers to itself as Tweel. Tweel accompanies Jarvis on his trip back to the Ares, in the course of which it manages to pick up some English, although Jarvis is unable to make any sense of Tweel's language. At first, Tweel travels in tremendous, city-block-long leaps that end with its long beak buried in the ground, but upon seeing Jarvis trudge along, walks beside him.
Upon reaching Xanthus, a desert region outside the Mare Cimmerium, Jarvis and Tweel find a line of small pyramids tens of thousands of years old made of silica bricks, each open at the top. As they follow the line, the pyramids slowly become larger and newer. By the time the pyramids are ten feet high, the travelers reach the end of the line and find a pyramid that is not open at the top. As they watch, a creature with gray scales, one arm, a mouth and a pointed tail pushes its way out of the top of the pyramid, pulls itself several yards along the ground, then plants itself in the ground by the tail. It starts exhaling bricks from its mouth at ten-minute intervals and using them to build another pyramid around itself. Jarvis realizes that the creature is silicon-based rather than carbon-based; neither animal, vegetable nor mineral, but a little of each. The strange combination of a creature produces the solid substance silica and builds itself in with the by-product, then sleeps for an unknown length of time.
As the two approach a canal cutting across Xanthus, Jarvis is feeling homesick for New York City, thinking about Fancy Long, a woman he knows from the cast of the Yerba Mate Hour show. When he sees Long standing by the canal, he begins to approach her, but is stopped by Tweel. Tweel takes out a gun that fires poisoned glass needles and shoots Long, who vanishes, replaced by one of the tentacled creatures that Jarvis rescued Tweel from at their first meeting. Jarvis realizes that the tentacled creature, which he names a dream-beast, lures its prey by projecting illusions into their minds.
As Jarvis and Tweel approach a city on the canal bank, they are passed by a barrel-like creature with four legs, four arms, and a circle of eyes around its waist. The barrel creature is pushing an empty, coppery cart; it pays no attention to Jarvis and Tweel as it goes by them. Another goes by, then a third. Jarvis stands in front of the third, which stops. Jarvis says, "We are friends," and the cart creature repeats the phrase from a diaphragm atop its body, "We are v-r-r-riends," before pushing past him. The next cart creature repeats the phrase as it goes by, and the next.
Eventually the cart creatures start returning to the city with their carts full of stones, sand, and chunks of rubbery plants. Jarvis stands in front of one and refuses to move. The cart creature tweaks his nose hard enough to make him jump aside and yell "Ouch". After that, every cart creature that passes by says "We are v-r-r-riends! Ouch!"
Jarvis and Tweel follow the cart creatures to their destination, a mound with a tunnel leading down below it. Jarvis soon becomes lost in the network of tunnels, and hours or days pass before he and Tweel find themselves in a domed chamber near the surface. There they find the cart creatures depositing their loads beneath a wheel that grinds the stones and plants into dust. Some of the cart creatures also step under the wheel themselves and are pulverized. Beyond the wheel is a shining crystal on a pedestal. When Jarvis approaches it he feels a tingling in his hands and face, and a wart on his left thumb dries up and falls off. He speculates that the crystal emits some form of radiation that destroys diseased tissue but leaves healthy tissue unharmed.
The cart creatures suddenly begin attacking Jarvis and Tweel, who retreat up a corridor which fortunately leads outside. The cart creatures corner them and, rather than save himself, Tweel stays by Jarvis' side facing certain death. The cart creatures are about to finish them off when an auxiliary rocket from the Ares lands, destroying the creatures. Jarvis boards the rocket while Tweel bounds away into the Martian horizon. The rocket returns with Jarvis to the Ares, and he tells his story to the other three. Jarvis is preoccupied with recalling the friendship and bond between Tweel and himself when Captain Harrison expresses regret that they do not have the healing crystal. Jarvis, his mind somewhere else, admits that the cart creatures were attacking him because he took it; he takes it out and shows it to the others.
Output: How are the pyramids in Xanthus created?