Queen Ann Soforth of Oogaboo, a small monarchy separated from the rest of Oz's Winkie Country, sets out to raise an army to conquer Oz. Seventeen men eventually make up the Army of Oogaboo; they march out of their valley. Glinda magically rearranges the path through the mountains and Queen Ann and her army march out of Oz into a low-lying, befogged country.
Betsy Bobbin, a girl who is a year older than Dorothy Gale, and her loyal mule Hank are washed ashore during a storm. They arrive at a large greenhouse that is the domain of the Rose Kingdom, where the roses tell them that no strangers are allowed. Just as the Royal Gardener (apparently the only human allowed in this flowery kingdom) is about to pass sentence on Betsy and Hank, the Shaggy Man falls through the greenhouse's roof, and charms the Gardener into sparing all of their lives with his Love Magnet. The flowers, not having hearts, are unaffected by the Magnet, and force the travellers to leave, taking with them the newly plucked Rose Princess Ozga, a cousin of Ozma, the ruler of Oz.
The Shaggy Man relates how Ozma sent him here by means of the Magic Belt because he wanted to find his brother, who went digging underground in Colorado and disappeared. He surmised that the Nome King, ruler of the underground Nome Kingdom, captured him. They meet up with Polychrome the Rainbow's Daughter; and they rescue Tik-Tok from the well where the Nome King had tossed him. Once Tik-Tok is wound up, he accompanies Betsy, Hank, the Shaggy Man, Ozga, and Polychrome to their chance encounter with Queen Ann and her army. In a rage, Queen Ann orders them to be seized and bound, but Private Files   the only private in this army of generals, colonels, and majors   refuses to bind innocent girls. He resigns his commission on the spot. When Queen Ann learns of the riches to be found in the Nome King's underground kingdom, she calms down and accepts the services of Tik-Tok as her new private.
The Nome King (who has recovered from having drunk the Water of Oblivion in The Emerald City of Oz) is aghast at this group coming toward his underground kingdom. Since no one can be killed in Oz, the Nome King seeks to discourage them, first by taking them through the Rubber Country, and then disposing of them by dropping them through the Hollow Tube, a conduit leading to the other side of the world.
There the party enters the jurisdiction of the immortal called Tittiti-Hoochoo, the Great Jinjin, who vows to punish the Nome King for using the Hollow Tube. He sends Tik-Tok and the others back with his Instrument of Vengeance, a lackadaisical dragon named Quox. Quox and his riders bound from the other end of the Tube into an army of Nomes and narrowly evade them. Queen Ann and the Army of Oogaboo fall into the Slimy Cave when they enter the Nome Kingdom; the Shaggy Man and his companions are captured by the Nome King. Ann and her army escape the cave while the Nome King amuses himself by transforming his captives into various objects. Quox arrives, bursting through the main cavern. The Nome King sees the ribbon around Quox's neck and forgets all the magic he ever knew. The Nome King is driven out of his kingdom when Quox releases six eggs from the padlock around his neck. The eggs, poisonous to Nomes, follow the Nome King to the Earth's surface and confine him there.
The new Nome King, the former chief steward Kaliko, vows to help the Shaggy Man find his brother, who he knows is in the Metal Forest. The Shaggy Man meets his brother in the center of the Forest; but the brother was cursed with a charm of ugliness by the former Nome King. A kiss will break a charm. First Betsy, a mortal maid, tries to undo the spell, then Ozga, a mortal maid who was once a fairy. Finally, it's the fairy Polychrome's kiss that restores the Shaggy Man's brother to his former self.
There is a banquet of rejoicing in the Nome Kingdom, and the former Nome King earnestly pleads to be let back into the underground lair ("No Nome can really be happy except underground"), which Kaliko allows on condition that he behave himself. Once on the surface again, Polychrome ascends her rainbow and Ozma uses the magic belt to bring Tik-Tok back to Oz and send Queen Ann, the Army of Oogaboo, Files, and Ozga back to Oogaboo. The Shaggy Man only agrees to return when his brother, Betsy, and Hank are allowed to enter Oz too.
Upon being welcomed in Oz, Hank, the Cowardly Lion, the Hungry Tiger, and the Saw-Horse debate who is the best mistress   Betsy (for Hank), Dorothy (for the Lion and the Tiger), or Ozma (for the Saw-Horse). The three girls are listening and laugh at a silly quarrel, which the animals realize is silly too. In addition, Dorothy finally gets to hear her dog Toto speak   for all animals can in the Land of Oz. Finally, Betsy decides to stay in Oz forever.
Output: What did Ozma use to send everyone back to their homes?