The following contains spoilers for House of the Dragon Season 1 and George R. R. Martin's Fire & Blood.

Daenerys Targaryen might have thought she was the last Targaryen after her brother's death in Game of Thrones, but she was wrong. Plenty of characters were distantly related to the Targaryens, including Oberyn Martell and Robert Baratheon (and by extension, Robert's son Gendry). Of course, there were also the direct descendants Maester Aemon Targaryen and Jon Snow, the latter of whom's real parents were revealed to be Lyanna Stark and Rhaegar Targaryen. This means that Jon Snow is very distantly related to Daemon Targaryen of House of the Dragon.

Despite how controversial he is, Daemon quickly became a fan-favorite on House of the Dragon. Never mind that he killed his first wife in cold blood and choked his third wife (who also happens to be his niece), fans couldn't get enough of his snappy comments and resilient, powerful nature. He and Jon Snow couldn't be more polar opposites, except for the fact that they're both great warriors and Targaryens at heart. Through a lot of inbreeding and a few marriages outside the family, Daemon is technically Jon's great, great, great, great, great, great-grandfather. Let's break down how exactly Jon is distantly related to Daemon by taking a closer look at Daemon's legacy.

RELATED: A House of The Dragon Theory Suggests Aemond Is The Father of Helaena's Kids

The Connection Begins With Daemon's Last Son Viserys II

Rhaenyra holds baby Viserys in House of the Dragon

Daemon Targaryen had many children in his lifetime with his second wife Laena Velaryon and his third wife Rhaenyra Targaryen. One of his sons with Rhaenyra, Viserys II, was the tenth king of Westeros and is Daemon's direct connection to Jon. House of the Dragon fans will recognize Viserys II as the baby King Viserys smiles at and claims the name is "fit for a king."

During the Dance of the Dragons, Viserys II and his older brother Aegon III were sent to Essos until Rhaenyra secured the Iron Throne. However, along the way he became a hostage to House Rogare, and later married the youngest daughter of the house, Larra. They had three children: Aegon IV, Aemon and Naerys. Sticking with the Targaryen tradition, Aegon IV and Naerys married and had two children themselves: Daenerys (not to be confused with the beloved Game of Thrones character) and Daeron II. Aegon IV also had a ton of other children, but they aren't direct ancestors of Jon Snow.

RELATED: Doctor Who's David Tennant Masterfully Trolls His Son During a Fan Event

Daeron II's Marriage to Myriah Martell Produced Many Heirs

Game of Thrones' Maester Aemon Stands on Stairs At Castle Black

Daeron II (Daemon's great-grandson) was the twelfth king of Westeros, known as Daeron the Good. He managed to bring Dorne into the realm, which proved to be a difficult feat in the past but worked because of his marriage to Princess Myriah Martell. They had four sons together: Baelor (named after Baelor the Blessed), Aerys I, Rhaegel and Maekar I.

Jumping ahead a few kings, Daeron II's youngest son Maekar I unexpectedly became the fourteenth king in 221 AC after his brothers' and nephews' deaths. Maekar I never had it easy, being a king between two Blackfyre rebellions, but managed to keep the realm intact. With his wife Dyanna Dayne, Maekar had a total of six children, but the most prominent ones to know are Aemon Targaryen (the maester at Castle Black in Game of Thrones), and Aegon V (Jon's great-great-great grandfather).

RELATED: The Crown (Surprisingly) Mirrors House of the Dragon’s Targaryen Downfall

Aegon V's Line Created the Mad King and Jon's Father

the mad king sitting on the iron throne in game of thrones

Aegon V would eventually become the fifteenth king of Westeros after Aemon surpassed the throne in favor of becoming a maester. He's referenced during Aemon's death in Game of Thrones when he hallucinates Aegon V, whom Aemon affectionately called "Egg." At this point in the Targaryen lineage, it was well assumed that "madness" passed through the Targaryens, but Aegon V was said to be innocent and beloved by smallfolk.

With his wife Betha Blackwood, Aegon V had five children. Two of their children, Shaera and Jaeherys II (Jon's great-grandfather), married even though their father wanted to end the Targaryen custom of incestuous marriages. Shaera and Jaeherys II only had two children: Aerys II and Rhaella. Jaeherys II became king when his older brother Duncan gave up the throne to marry Jenny of Oldstones, who had a song named after her.

At this point, there were few Targaryens left. Jaeherys and Shaera's sister Rhaella married a Baratheon and continued the Baratheon line, and their brothers Duncan and Daeron didn't have children. After Jaeherys II's death at a young age, Aerys II inherited the throne and married his sister Rhaella. They had a total of eight children, but only three lived until adulthood: Rhaegar, Viserys and Daenerys.

RELATED: Sylvester Stallone Delivers a Blow to House of the Dragon's Ratings Record

Rhaegar Targaryen Secretly Married Lyanna Stark and Had Jon Snow

GOT - Rhaegar Targaryen and Lyanna Stark Hold Each Other Lovingly

Rhaegar married Elia Martell and had Rhaenys and Aegon Targaryen. Although it was believed that Rhaegar kidnapped and raped Lyanna Stark -- which started Robert's Rebellion -- Rhaegar actually loved her and married her. The two had a child -- another Aegon Targaryen -- who a dying Lyanna asked Ned to take in as his bastard son. Ned named him Jon Snow, and the rest is history.

As fans know, Rhaegar was killed at the Battle of the Trident and Jaime Lannister killed Aerys II, seemingly ending the Targaryen reign. Of course, eight seasons of Game of Thrones proved otherwise. But it's fascinating to examine how much detail went into the Targaryen family tree, all the way from House of the Dragon's Daemon Targaryen to the last Targaryen, Jon Snow.

To see more of this complicated family, stream House of the Dragon Season 1 and Game of Thrones on HBO Max.