In Naruto, the story of the three legendary Sannin (Legend of Tam Nin) Konoha was inspired by a Japanese folk tale spanning more than 43 books called The Tale of Jiraiya the Gallant. about the brave Jiraiya). And the three Sannin in Naruto, Jiraiya, Tsunade and Orochimaru have a lot in common with the people of the same name in the above story.

Here is the story that inspired the legendary trilogy in Naruto by author Kishimoto Masashi:
The story in Japanese folklore tells of a young warlord who gains the power of frog magic, and fights with a slug princess to take down an evil snake spirit.

The story of Jiraiya Goketsu Monogatari begins with the threat of an evil snake spirit that eats humans and wants to completely rule Japan. The snake took possession of the body of a child named Orochimaru to carry out his evil plan, destroying the balance of the three most powerful clans in Japan (Ogata, Matsuura, Tsukikage).
The snake spirit used Orochimaru to control the Tsukikage’s mind, making Orochimaru his successor, and destroyed the Ogata and Matsuura clans. The snake spirit also harmed Ogata and Matsuura’s successors, Jiraiya and Tsunade, throwing them off a cliff, but both survived.
While Jiraiya was taught toad magic, Tsunade was taught slug magic. Later, Jiraiya and Tsunade faced Orochimaru in a fierce battle. To defeat Orochimaru, Jiraiya obtained Nakirimaru and cut the connection between the evil snake spirit and Orochimaru.

When the snake spirit was destroyed, the Ogata and Matsuura clans returned to power, and Jiraiya and Tsunade got married. Orochimaru was also pardoned by Jiraiya, as he did bad deeds due to being manipulated by snake spirits.
Having heard of this Japanese folk tale, have you found it similar to the plot of the three legendary Konoha Sannins? Apparently, through Naruto, Kishimoto Masashi perfectly recreated the Japanese folk tale in the shinobi world.