Supreme Chancellor Valorum, leader of the Galactic Republic, dispatches Jedi Master Qui-Gon Jinn and his apprentice, Obi-Wan Kenobi, to negotiate with the Trade Federation leadership to end a blockade of battleships around the planet Naboo. Darth Sidious, a Sith Lord and the Trade Federation's secret adviser, orders Federation Viceroy Nute Gunray to kill the Jedi and invade Naboo with an army of battle droids. The Jedi escape and flee to Naboo, where Qui-Gon saves a Gungan outcast, Jar Jar Binks, from being killed during the invasion. Indebted to the Jedi, Jar Jar leads them to an underwater Gungan city. The Jedi unsuccessfully try to persuade the Gungan leader, Boss Nass, into helping the people of Naboo, though they are able to obtain transportation to Theed, the capital city on the surface. They rescue Queen Amidala, the ruler of the Naboo people, and escape the planet on her royal starship, which is damaged as they pass the Federation blockade.
Amidala's ship is unable to sustain its hyperdrive and lands for repairs on the desert planet Tatooine. Qui-Gon, Jar Jar, astromech droid R2-D2, and Amidala (in disguise as Padm , her handmaiden) visit the settlement of Mos Espa to buy new parts at a junk shop. They meet the shop's owner Watto and his nine-year-old slave, Anakin Skywalker, who is a gifted pilot and engineer and has created a protocol droid called C-3PO. Qui-Gon senses a strong presence of the Force within Anakin and is convinced that he is the "chosen one" of Jedi prophecy who will bring balance to the Force. Qui-Gon wagers Anakin's freedom with Watto in a Podrace, which Anakin wins. Anakin joins the group to be trained as a Jedi, leaving his mother, Shmi, behind. En route to their starship, Qui-Gon briefly duels with Darth Maul, Darth Sidious's apprentice, who was sent to capture Amidala.
The Jedi escort Amidala to the Republic capital planet, Coruscant, so she can plead her people's case to Chancellor Valorum and the Galactic Senate. Qui-Gon asks the Jedi Council for permission to train Anakin as a Jedi, but the Council, concerned that Anakin is vulnerable to the dark side, refuse. Undaunted, Qui-Gon vows to train Anakin anyway. Meanwhile, Naboo's Senator Palpatine persuades Amidala to make a vote of no confidence in Valorum to elect a more capable chancellor to resolve the crisis on Naboo. Though she pushes for the vote, Amidala grows frustrated with the corruption in the Senate and decides to return to Naboo with the Jedi.
On Naboo, Padm  reveals herself to the Gungans as Queen Amidala and persuades them into an alliance against the Trade Federation. Jar Jar leads his people in a battle against the droid army while Padm  leads the hunt for Gunray in Theed. In a starship hangar, Anakin enters a vacant starfighter and inadvertently triggers its autopilot, joining the battle against the Federation droid control ship in space. Anakin ventures into the ship and destroys it from within, deactivating the droid army. Meanwhile, Qui-Gon and Obi-Wan battle Darth Maul, who mortally wounds Qui-Gon before being bisected by Obi-Wan. As he dies, Qui-Gon asks Obi-Wan to train Anakin. Subsequently, Palpatine is elected as the new Supreme Chancellor and Gunray is arrested. The Jedi Council promotes Obi-Wan to the rank of Jedi Knight and reluctantly accepts Anakin as Obi-Wan's apprentice. At a festive ceremony, Padm  presents a gift of appreciation and friendship to the Gungans.
Output: Who does Qui-Gon, Jar Jar, R2-D2, and Amidala meet when they go to Watto's shop for ship parts?