Fact1: Ahmad is convinced by evil Grand Vizier Jaffar to go out into city disguised as poor man to get to know subjects, Fact2: Princess now deeply in love with Ahmad Upon runs hearing this, Fact3: Abu returned to human form, Fact4: genie flies Abu to top of highest mountain in world, Fact5: Eye show him location of Ahmad
Output: Ahmad, the naive sultan of Bagdad, is convinced by his evil Grand Vizier Jaffar to go out into the city disguised as a poor man to get to know his subjects in the manner of his grandfather Harun alRashid. Jaffar then has Ahmad thrown into a dungeon, where he encounters the young thief Abu, who arranges their escape. They flee to Basra, where Ahmad meets its Princess. Jaffar journeys to Basra, for he too desires the Princess. Her father, the Sultan, is fascinated by the magical mechanical flying horse that Jaffar, a skilled sorcerer, offers; he agrees to the proposed marriage. Upon hearing this, the Princess, now deeply in love with Ahmad, runs away. Confronted by Ahmad, Jaffar magically blinds him and turns Abu into a dog; the spell can only be broken if Jaffar holds the Princess in his arms. The Princess is captured and sold in the slave market. She is bought secretly by Jaffar, but falls into a deep sleep from which he cannot rouse her. Ahmad is tricked by Jaffars servant Halima into awakening the Princess. Halima then lures her onto Jaffars ship by telling her that there is a doctor aboard who can cure Ahmads blindness. Jaffar informs the Princess about the spell, so she allows herself to be embraced; Ahmads sight is restored and Abu returned to human form. They pursue in a small boat, but Jaffar conjures up a storm that shipwrecks them. The Princess persuades Jaffar to return her to Basra; she implores her father not to force her into the marriage. Furious when the Sultan agrees, Jaffar presents him with another mechanical toy: the Silver Maid, a manyarmed dancing statue which stabs the Sultan to death. Abu awakes alone on a deserted beach and finds a bottle. When he opens it, an enormous genie appears. Embittered by his imprisonment, the genie informs Abu that he is going to kill him, but Abu tricks him back into the bottle. The genie then offers to grant Abu three wishes if he will let him out again. The hungry boy uses his first wish to ask for sausages. When Abu demands to know where Ahmad is, the genie flies Abu to the top of the highest mountain in the world, where inside a temple is an enormous statue with a large jewel, the AllSeeing Eye, set in its forehead. The genie tells Abu that the Eye will show him the location of Ahmad. Abu fights off a giant spider while climbing the statue to steal the gem. The genie then takes Abu to Ahmad. When Ahmad asks to see the Princess, Abu has him gaze into the AllSeeing Eye, where he sees Jaffar arranging for the Princess to inhale the fragrance of the Blue Rose of Forgetfulness, which makes her forget her love. In agony, Ahmad lashes out at Abu. During the ensuing argument, Abu unthinkingly wishes Ahmad to Bagdad. The genie, freed after granting the last wish, abandons Abu in the wilderness. Ahmad appears in Jaffars palace and is quickly captured, but seeing him restores the Princesss memory. The furious usurper sentences them both to death. Abu, unwilling to watch further, shatters the AllSeeing Eye and is transported to the land of legend, where he is thanked by the Old King for freeing its inhabitants. As a reward, he is given a magic crossbow and is named the kings successor. To save Ahmad, however, Abu steals the kings magic flying carpet and rushes to Ahmads rescue. Abus aerial arrival in Bagdad which fulfills a prophecy cited a few times during the course of the film sparks a revolt against Jaffar. Abu kills the fleeing Jaffar with his crossbow, and Ahmad regains his kingdom and his love. However, when Abu hears Ahmad telling the people of his plan to send Abu to school to train to become his new Grand Vizier, Abu flies away on the carpet to find fun and adventure.