Question: how is Joseph Ferdinand of Bavaria and Leopold I, Holy Roman Emperor related?

full_context: Document 1: Rudolf II, Holy Roman Emperor: Rudolf II (18 July 1552 – 20 January 1612) was Holy Roman Emperor (1576–1612), King of Hungary and Croatia (as Rudolf I, 1572–1608), King of Bohemia (1575–1608/1611) and Archduke of Austria (1576–1608). He was a member of the House of Habsburg.
Document 2: Ferdinand, Duke of Breisgau: Archduke Ferdinand Karl of Austria-Este (1 June 1754 – 24 December 1806) was a son of Holy Roman Emperor Franz I and Maria Theresa of Austria. He was the founder of the House of Austria-Este and Governor of the Duchy of Milan between 1765 and 1796. He was also designated as the heir to the Duchy of Modena and Reggio, but he never reigned, owing to the Napoleonic Wars.
Document 3: Archduke Alexander Leopold of Austria: Archduke Alexander Leopold of Austria (Alexander Leopold Johann Joseph; Hungarian: "Sándor Lipót" ; 14 August 1772 – 12 July 1795) was Palatine of Hungary, appointed during the reign of his father, Holy Roman Emperor Leopold II, and serving into the reign of his elder brother, Holy Roman Emperor Francis II.
Document 4: Leopold I of Belgium: Leopold I (French: "Léopold I" , German and Dutch: "Leopold I" ; 16 December 1790 in Coburg – 10 December 1865 in Laeken) was a German prince who became the first King of the Belgians following Belgian independence in 1830. He reigned between July 1831 and December 1865.
Document 5: Louis Joseph, Dauphin of France: Louis Joseph de France (Louis Joseph Xavier François; 22 October 1781 – 4 June 1789) was the second child and elder son of King Louis XVI of France and Marie Antoinette. As son of a king of France, he was a "fils de France" ("Son of France"), and as the eldest son and heir apparent, he was Dauphin of France, (the twenty-sixth "crown prince" of the Capetian and Bourbon monarchies).
Document 6: Joseph II, Holy Roman Emperor: Joseph II (Joseph Benedikt Anton Michael Adam; 13 March 1741 – 20 February 1790) was Holy Roman Emperor from 1765 to 1790 and ruler of the Habsburg lands from 1780 to 1790. He was the eldest son of Empress Maria Theresa and her husband, Emperor Francis I, and was the brother of Marie Antoinette. He was thus the first ruler in the Austrian dominions of the House of Lorraine, styled Habsburg-Lorraine. Joseph was a proponent of enlightened absolutism; however, his commitment to modernizing reforms subsequently engendered significant opposition, which eventually culminated in an ultimate failure to fully implement his programmes. He has been ranked, with Catherine the Great of Russia and Frederick the Great of Prussia, as one of the three great Enlightenment monarchs. His policies are now known as Josephinism. He died with no sons and was succeeded by his younger brother, Leopold II.
Document 7: Maria Theresa of Austria-Este (1849–1919): Maria Theresa of Austria-Este (Maria Theresa Henriette Dorothee; 2 July 1849 – 3 February 1919) was the last Queen of Bavaria. She was the daughter and only child of Archduke Ferdinand of Austria-Este and his wife, Archduchess Elisabeth of Austria.
Document 8: Maria Amalia of Austria: Maria Amalia of Austria (Maria Amalie Josefa Anna; 22 October 1701 – 11 December 1756) was Holy Roman Empress, Queen of the Germans, Queen of Bohemia, Electress and Duchess of Bavaria etc. as the spouse of Charles VII, Holy Roman Emperor. By birth, she was an Archduchess of Austria as the daughter of Joseph I, Holy Roman Emperor and Wilhelmine Amalia of Brunswick-Lüneburg.
Document 9: Maria Josepha of Bavaria: Maria Josepha of Bavaria (Marie Josephe Antonie Walburga Felicitas Regula, 20 March 173928 May 1767) was Holy Roman Empress, Queen of the Romans, Archduchess of Austria, Grand Duchess of Tuscany, etc. by her marriage to Joseph II, Holy Roman Emperor. By birth, she was a Princess and Duchess of Bavaria as the daughter of Charles VII, Holy Roman Emperor, Elector of Bavaria, and Archduchess Maria Amalia of Austria.
Document 10: Ferdinand III, Holy Roman Emperor: Ferdinand III (13 July 1608 – 2 April 1657) was Holy Roman Emperor from 15 February 1637 until his death, as well as King of Hungary and Croatia, King of Bohemia and Archduke of Austria. He was the last emperor to have real power over the Holy Roman Empire.
Document 11: Ferdinand I, Holy Roman Emperor: Ferdinand I (Spanish: "Fernando I" ) (10 March 1503 – 25 July 1564) was Holy Roman Emperor from 1558, king of Bohemia and Hungary from 1526, and king of Croatia from 1527 until his death. Before his accession, he ruled the Austrian hereditary lands of the Habsburgs in the name of his elder brother, Charles V, Holy Roman Emperor. Also, he often served as Charles' representative in Germany and developed useful relationships with German princes.
Document 12: Leopold I, Holy Roman Emperor: Leopold I (name in full: "Leopold Ignaz Joseph Balthasar Felician"; Hungarian: "I. Lipót" ; 9 June 1640 – 5 May 1705) was Holy Roman Emperor, King of Hungary, Croatia, and Bohemia. The second son of Ferdinand III, Holy Roman Emperor, by his first wife, Maria Anna of Spain, Leopold became heir apparent in 1654 by the death of his elder brother Ferdinand IV. Elected in 1658, Leopold ruled the Holy Roman Empire until his death in 1705.
Document 13: Rudolf, Crown Prince of Austria: Rudolf, Crown Prince of Austria (Rudolf Franz Karl Joseph; 21 August 1858 – 30 January 1889) was the only son of Emperor Franz Joseph I and heir apparent to the throne of Austria-Hungary from birth. In 1889, he died in a suicide pact with his mistress, Baroness Mary Vetsera, at the Mayerling hunting lodge. The ensuing scandal made international headlines. He was named after the first Habsburg King of Germany, Rudolf I, who assumed the throne in 1273.
Document 14: Joseph Ferdinand of Bavaria: Joseph Ferdinand Leopold of Bavaria (28 October 1692 – 6 February 1699) was the son of Maximilian II Emanuel, Elector of Bavaria (1679–1705, 1714–1726) and his first wife, Maria Antonia of Austria, daughter of Leopold I, Holy Roman Emperor, maternal granddaughter of King Felipe IV of Spain.
Document 15: Maximilian I, Holy Roman Emperor: Maximilian I (22 March 1459 – 12 January 1519) was King of the Romans (also known as King of the Germans) from 1486 and Holy Roman Emperor from 1493 until his death, though he was never crowned by the Pope, as the journey to Rome was always too risky. He was the son of Frederick III, Holy Roman Emperor, and Eleanor of Portugal. He ruled jointly with his father for the last ten years of his father's reign, from c. 1483 to 1493.
ground_truth: King