In 1905 Kansas, Oscar "Oz" Diggs works as a magician in a traveling circus. After his friend Annie tells him that John Gale has asked her to marry him, the circus strongman finds out that Oscar flirted with his wife, and threatens him. Oscar escapes in a hot air balloon, but is sucked into a tornado that takes him to the Land of Oz. There, he encounters a beautiful but naive witch, Theodora. She believes him to be a wizard prophesied to defeat a Wicked Witch who killed the King of Oz and take his place as the next king; the idea of being an immensely wealthy monarch makes Oscar immediately accept. En route to the Emerald City, Theodora falls in love with Oscar, though he does not reciprocate her feelings. They encounter the flying monkey in a blue uniform, Finley, who pledges a life debt to Oscar when he saves him from a lion. Oscar reveals his deception to Finley along the way, forcing him to help maintain the lie that he is a 'Wizard', much to Finley's irritation.At the Emerald City, Oscar meets Theodora's beautiful older sister Evanora, the Royal Advisor. Evanora tells him the Wicked Witch resides in the Dark Forest and can be killed by destroying her wand, the source of her powers; only then will Evanora consent to him becoming King of Oz. Oscar and Finley are joined en route to the forest by China Girl, a young, living china doll whose village and family were destroyed by the Wicked Witch's flying baboons. Oscar fixes the China Girl's broken legs with glue. They reach the forest and retrieve the wand, but they discover the "Wicked Witch" is really Glinda the Good Witch who identifies herself as the daughter of the late King, revealing that Evanora is the true Wicked Witch. Evanora sees this with her crystal ball and tricks the naive Theodora into thinking Oscar is trying to court all three witches. She offers the heartbroken Theodora a magic apple that she says will remove her bad feelings about Oscar; Theodora bites it and realizes that Evanora deceived both her and Oscar before she is transformed into a hideous, green-skinned witch. Glinda brings Oscar and his group to her kingdom in the south of Oz to escape Evanora's army of Winkies and flying baboons. She confides to Oscar that she knows that he's not really a wizard, but still believes he can help stop Evanora. As he reluctantly takes charge of an "army" of Quadlings, Tinkers, and Munchkins, Theodora enters Glinda's kingdom and angrily reveals her new, hideous appearance to Oscar. She threatens to kill him and his allies with the Emerald City's well-prepared army. Oscar despairs at his chances of victory. After telling China Girl about the exploits of his hero Thomas Edison, he conceives a plan that relies on trickery and makes preparations with Glinda and his group.Glinda and her subjects mount a fake attack on the Emerald City using an army of scarecrow puppets whose true nature is hidden by thick fog. The witches are tricked into sending their Flying Baboons through the deadly poppy fields that puts them into everlasting sleep. However, two of the Baboons and Evanora capture Glinda, who is then brought to the city square and chained. Oscar infiltrates the Emerald City with his allies but appears to abandon them in a hot air balloon which he loads with stolen gold. Theodora destroys the balloon with a fireball, but Oscar was never actually in the balloon. As the Wicked sisters prepare to kill Glinda, Oscar secretly reveals his engineered death to his friends. Using a hidden smoke machine and image projector, he presents a giant image of his face amid smoke and flame as his "true form", and calls upon "the stars themselves" (a fireworks display) to intimidate the wicked sisters. Evanora fearfully hides in the castle, while Theodora flies off on her broom after her attacks fail to hurt the "invincible" wizard. Oscar calls after her, telling her that she is welcome to come back if she overcomes her wickedness, but Theodora screams defiance at him and flies to the west, leaving Oscar saddened. China Girl frees Glinda, who engages in a magical duel with Evanora in the throne room. During the fight, Glinda destroys the Wicked Witch's emerald necklace that hides her true, aged, crone-like appearance. Defeated, the banished Evanora is rescued by the two remaining Flying Baboons, swearing revenge as she is carried into the east.Oscar, now the King of Oz, decides to continue using his projector to sustain the belief he is a powerful wizard. He also presents gifts to his friends: Master Tinker, who helped build his machines, receives Oscar's camping tool; Knuck, the grumpy Munchkin herald, receives a mask with a smiley face; the long-suffering Finley receives Oscar's friendship (at last) along with his top hat; and China Girl accepts her friends as her new family. Finally, Oscar takes Glinda behind the curtains of his projector, thanks her for making him a better person, accepts his life in Oz, and they kiss.
Output: Question: What does Oscar thank Glinda for?, Answer: making him a better person