A name of a cartoon ( probably Hungarian Folk Tales)?

It s an episode starting with a poor man not having the resourses to keep his family alive having a conversation with god and denying his help after some time he incounters death or the devil and in ther deal his son has a talent of curing anyones sickness if death says they live at the end the princess must day and the boy trades his life for hers by putting her life candle on top of hers. His son gets the talent* The princess must die* By putting her life candle on top of his*