Seven Riddles of Complex Family Relationships, and Their Solutions: A Case Study in AI-Generated Diagrams in HTML and SVG (Yevamot 97b)
I’ve been sitting on this sugya for a very long time, since AI wasn’t yet good enough to help with it.
I tested it again recently, and was positively surprised to find that Claude Code succeeded perfectly, zero shot. (See footnote for full technical details.)1
Formula
Riddle
The riddles are all in first-person voice, spoken by a woman (the narrator/speaker), describing a male relative (the subject/protagonist).
Some of them start with a literary opening.
Eg.:
1)
״דלאי דדלו דוולא,
ליפול בכו סתר פתר:
Water drawers (דלאי), who draw water (דלו) in buckets (דוולא),
let fall among you this cryptic riddle (סתר פתר):
2)
״שלמא לך
Peace upon you,
3)
״בייא בייא מ
Woe, woe [baya, baya] for
In one, the ending also contains a literary element (i.e. not directly related to the riddle), in the final - 7th - line:
ולא יהיב פיתא לאחוה יתמי בני ברתיה״
and he does not provide bread for his brothers, who are orphans, the sons of [me], his daughter.
Solution
The Talmud’s recurring (6x) formula for introducing the solution to the riddle:
משכחת לה ב:
גוי הבא על [קרובה]
You find it in [the case of]:
a non-Jew2 who had sex3 with his [female relative - mother / daughter / granddaughter]
Outline
Intro
Formula
Riddle
Solution
The Passage
Half-Brother and Mother’s Husband
Riddle
Note based on implied solution
Brother and Son
Riddle
Solution
Son and Sister’s Daughter
Riddle
Solution
Son and Brother’s Daughter
Riddle
Solution
Brother, Father, Husband, and Son of Husband
Riddle
Solution
Sibling Relationships Across Generations
Riddle
Solution
Cousins from Both Sides
Riddle
Solution
Appendix - Table Summarizing
The Passage
ChavrutAI: Yevamot/97b#1 thru #7
Sefaria: Yevamot.97b.1-7
1. Half-Brother and Mother’s Husband
F begets a son (H) and, separately, a daughter (S). Later H marries A — permitted because F was never married to A.
How the relationships hold:
Half-brother by father, not mother: H and S share father F, but have different mothers (B and A).
Husband of my mother: H later marries A.
I am the daughter of his wife: S is the biological daughter of A — the woman H married.
Why this is permitted (Rabbis): F was never married to A; the relationship that produced S was outside marriage. Per the majority view, that does not bar F’s son H from later marrying A. R’ Yehuda would forbid it.
Riddle
A woman states: “I have a (half-)brother from my father, and he is also my mother’s husband, and I am the daughter of his wife.”
״אח מאב ולא מאם,
והוא בעלה דאם,
ואנא ברתה דאנתתיה״.
The opinion that a man may marry a woman raped or seduced by his father can lead to the existence of an unusual family relationship:
A woman says: I have
a half brother from my father and not from my mother,
and my half brother is the husband of my mother,
and I am the daughter of his wife.
Note based on implied solution
Rami bar Ḥama notes that this situation is inconsistent with R’ Yehuda’s position in the Mishna, which prohibits a man from marrying a woman with whom his father had relations. However, according to other Rabbis, this scenario is legitimate if the father and mother were not married.
אמר רמי בר חמא:
דלא כרבי יהודה דמתניתין.
Rami bar Ḥama said:
This state of affairs is not legitimate according to the opinion of R’ Yehuda in the Mishna,
who holds that a man may not marry a woman with whom his father had sex, even if they were not married. However, according to the Rabbis, a woman whose father was not married to her mother can legitimately have a paternal half brother who is married to her mother.
2. Brother and Son
F’s daughter D bears him a son S. Through F, S is D’s brother; through D, S is her son.
How the relationships hold:
He is my brother: S and D share a father (F).
He is my son: D physically bore S.
Riddle
A woman declares: “He is my brother and my son”.
״אח הוא,
וברי הוא,
אחתיה אנא דהאי דדרינא אכתפאי״
The Talmud cites another riddle about a bizarre family relationship.
A woman says:
He is my brother
and he is my son;
I am the sister of this one, whom I carry on my shoulders.
Solution
The explanation is a man who (incestually) fathered a child with his daughter. The resulting child is both the daughter’s son and her brother.
משכחת לה ב
גוי הבא על בתו.
What is the solution?
You find it in the case of
a non-Jew who had sex with his daughter, and she bore him a son, who is therefore both her brother and her son.
The Talmud is referring to a non-Jew because it does not wish to entertain the idea that a Jew would act in such a manner.
3. Son and Sister’s Daughter
G fathers a daughter D. D has a daughter GD with another man. G then fathers a son S with GD. GD says to S: “I am the daughter of your sister” — because S’s paternal half-sister D is GD’s mother.
How the relationships hold:
S’s sister: S’s father is G. G’s daughter D is therefore S’s paternal half-sister.
I am the daughter of your sister: The speaker GD is D’s daughter — i.e., S’s sister’s daughter, even though she is also S’s mother.
Riddle
Another riddle involves a woman greeting someone: “Peace upon you, my son; I am the daughter of your sister.”
״שלמא לך
ברי,
בת אחתיך אנא״
The Talmud cites another riddle:
Peace upon you,
my son;
I am the daughter of your sister.
Solution
The scenario is resolved with a man who had a child with his granddaughter (his daughter’s daughter).
משכחת לה ב
גוי הבא על בת בתו.
You find the solution in the case of
a non-Jew who had sex with the daughter of his daughter, who bore him a son.
This son’s mother is related to him from her mother’s side as well, as she is his sister’s daughter.
4. Son and Brother’s Daughter
Now the granddaughter is reached through G’s son, not his daughter. S’s paternal brother SN is the speaker’s father.
How the relationships hold:
This boy is my son: GD physically bore S.
I am the daughter of his brother: S’s father is G. G’s son SN is therefore S’s paternal half-brother. GD is SN’s daughter — S’s “brother’s daughter.”
Variant on Riddle III: Riddle III went through the daughter (mother-side); Riddle IV goes through the son (father-side).
Riddle
“He is my son, and I am the daughter of his brother.”
״דלאי דדלו דוולא,
ליפול בכו סתר פתר:
דהאי דדרינא
הוא בר,
ואנא ברת אחוה״
The Talmud cites another riddle:
Water drawers, who draw water in buckets to irrigate fields,
let this cryptic riddle fall among you:
This boy whom I carry
is my son,
and I am the daughter of his brother.
Solution
The resolution involves a non-Jew who man a child with his grandson’s daughter (his son’s daughter). This makes the resulting child both her son and her uncle.
משכחת לה ב
גוי הבא על בת בנו.
You find the solution in the case of
a non-Jew who had sex with the daughter of his son,
as their son is also her uncle.
5. Brother, Father, Husband, and Son of Husband
Three incestuous unions stack on top of each other: O ↔ M (lawful), N ↔ M, N ↔ D, O ↔ D. The speaker D plays multiple roles in each.
How each claim about N holds (from D’s perspective):
My brother: N and D share mother M.
My father: N fathered D.
My husband: D had relations with N.
Son of my husband: O is also D’s “husband” (had relations with her); N is O’s son.
Husband of my mother: M is D’s mother; N had relations with M.
I am the daughter of his wife: D is M’s daughter; M is N’s “wife.”
His brothers, the orphan sons of his daughter: The sons born to D from O are: (i) N’s paternal half-brothers (same father, O); (ii) sons of N’s daughter D. So they are simultaneously N’s brothers and N’s grandchildren — and N refuses to feed them.
Riddle
A woman says: “My brother, who is my father, and my husband, and the son of my husband, and the husband of my mother. I am the daughter of his wife, and he does not provide for his brothers, the orphans.”4
״בייא בייא מ
אח,
והוא אב,
והוא בעל,
והוא בר בעל,
והוא בעלה דאם,
ואנא ברתה דאיתתיה,
ולא יהיב פיתא לאחוה יתמי בני ברתיה״
The Talmud cites another riddle:
Woe, woe [baya, baya] for
my brother,
who is my father,
and who is my husband,
and who is the son of my husband,
and who is the husband of my mother,
and I am the daughter of his wife;
and he does not provide bread for his brothers, who are orphans, the sons of me, his daughter.
Solution
This situation occurs when a man fathers a child with his mother, producing a daughter. He then fathers children with that daughter. This creates layers of relationships, including father, brother, husband, and son of husband.
משכחת לה ב
גוי הבא על אמו, והוליד ממנה בת,
וחזר ובא על אותה בת,
וחזר זקן ובא עליה, והוליד ממנה בנים.
You find the solution in the case of
a non-Jew who had sex with his mother, and she bore him a daughter. This daughter is both his sister and his daughter.
And he had sex with that daughter.
And then the old man, his father, had sex with her, and she bore him sons.
This woman is therefore the wife of her father-brother, and he is also the son of her husband, the old man. Her father’s brothers, i.e., the sons she had with the old man, are his daughter’s sons.
6. Sibling Relationships Across Generations
N has two daughters (D₁, D₂) with his own mother M, and a son (S) with one of them (D₁). D₂ is the speaker — addressing her sister’s son S.
How D₂ holds three different sibling relationships at once:
You and I are siblings (D₂ and S): Both share father N — paternal siblings.
Your father and I are siblings (D₂ and N): Both share mother M — maternal siblings. (D₂ is also N’s daughter, but the riddle highlights the sibling tie.)
Your mother and I are siblings (D₂ and D₁): Both are daughters of N and M — full siblings on both sides.
Riddle
A woman states: “You and I are siblings; your father and I are siblings; your mother and I are siblings.”
״אנא ואת — אחי,
אנא ואבוך — אחי,
אנא ואמך — אחי״
The Talmud cites another riddle:
You and I are siblings (אחי);
your father and I are siblings;
your mother and I are siblings.
Solution
This occurs when a man fathers two daughters with his mother and later fathers a son with one of these daughters. The sister of the boy’s mother then makes this statement to him, reflecting their convoluted familial ties.
משכחת לה ב
גוי הבא על אמו, והוליד ממנה שתי בנות,
וחזר ובא על אחת מהן, והוליד ממנה בן,
וקריא ליה אחתיה דאימא, וקאמרה ליה הכי.
You find the solution in the case of
a non-Jew who had sex with his mother, and she bore him two daughters,
and he then had sex with one of them, and she bore him a son.
And the sister of the son’s mother calls him and says this statement to him,
as she is his sister from his father’s side and his father’s sister from their mother’s side, and she is his mother’s sister from both sides.
7. Cousins from Both Sides
All three brothers (R, Sh, L) descend from a common patriarch. Sh marries his niece A; Levi’s son L’ marries his cousin B. SS (son of Sh) and L’‘ (grandson of Levi) are linked three different ways.
How SS and L’‘ are cousins three different ways:
You and I are cousins (SS and L’‘): Their mothers, A and B, are sisters (both daughters of Reuven) — cousins via the mothers’ line.
Your father and I are cousins (SS and L’): SS’s father is Shimon; L’‘’s father L’ is the son of Levi. Shimon and Levi are brothers, so their children SS and L’ are cousins via the fathers’ line.
Your mother and I are cousins (SS and B): SS is Shimon’s son; B is Reuven’s daughter. Shimon and Reuven are brothers, so SS and B are cousins via the fathers’ line.
The point: Unlike Riddles II–VI, no incest is required — only the systematic intermarriage of cousins across three brothers’ households.
Riddle
Finally, a riddle with a permitted resolution: “You and I are cousins; your father and I are cousins; your mother and I are cousins.”
״אנא ואת — בני אחי,
אנא ואבוך — בני אחי,
אנא ואמך — בני אחי״.
The Talmud cites another riddle:
You and I are cousins;5
your father and I are cousins;
your mother and I are cousins.
Solution
This occurs in a scenario involving Reuven, who has two daughters. One marries Reuven’s brother Shimon, and the other marries Levi’s grandson. The son of Shimon and the grandson of Levi address each other, reflecting their shared cousin relationships through both their fathers and mothers.
הא בהיתירא נמי משכחת לה —
כגון
ראובן שיש לו שתי בנות,
ואתא שמעון ונסב חדא מינייהו,
ואתא בר לוי ונסב חד מינייהו,
וקאמר ליה בריה דשמעון לבר בריה דלוי.
You find the solution to this riddle in a permitted manner as well.
For example,
Reuven, who has two daughters,
and his brother Shimon came and married one of them,
and the son of Levi, the third brother, came and married the other one of them.
And the son of Shimon says this statement to the grandson of Levi.
They are cousins from their mothers’ sides, Shimon’s son and Levi’s son are cousins from their fathers’ sides, and Shimon’s son and the mother of Levi’s grandson are cousins from their fathers’ sides.
Appendix - Table Summarizing
Final HTML webpage here: https://ezrabrand.github.io/yevamot-97b-riddles/
Github here: https://github.com/EzraBrand/yevamot-97b-riddles
Throughout this piece, the diagrams are screenshots of diagrams output by Claude (available at the aforementioned webpage), and the descriptions directly under the diagrams are copy-pasted from there. I reviewed them closely, there don’t seem to be any errors.
I tried with both Codex (5.5 - Medium wasn’t successful; I then tried again with “Extra High”, and after working for 10+ minutes, it did much better, but still wasn’t fully successful) and Claude Code (4.7 - Extra High).
This was the original prompt, attaching the sugya as a Markdown file (exported from ChavrutAI, here: https://chavrutai.com/sugya-viewer?Yevamot.97b.1-7 ):
@C:\Users\ezrab\Downloads\Yevamot_Yevamot_97b_1-7.mdin a new folder under this root folder (claude), develop html file that illustrates these Seven Riddles of Complex Incestous Family Relationships in talmud bavli Yevamot 97b
Full response, after a few minutes of work:
I’ll first check the project root, then create a new folder with an illustrated HTML file showing all seven riddles.
[Ran 2 commands]
Now I’ll create a comprehensive HTML file with all seven riddles, complete with SVG family tree diagrams.
[Created index.html]
Created
yevamot-97b-riddles/index.html— it’s now visible in the Launch preview panel.The page contains:
Header & intro explaining the genre of these riddles and the halakhic frame (Rabbis vs. R’ Yehuda).
Legend & TOC for the seven riddles.
One section per riddle, each with:
Aramaic original (right-to-left, Frank Ruhl Libre)
English translation alongside
Custom SVG family-tree diagram using genealogy conventions (squares = men, circles = women), with the speaker highlighted in gold and incestuous unions drawn as dashed red lines
A short “How the relationships hold” explainer
Special treatment for Riddle V (the most tangled — three generations of incest stacked) and Riddle VII (the permitted three-brothers solution).
On this latest successful attempt, I was inspired by these recent pieces:
Useful patterns for building HTML tools (https://simonwillison.net/2025/Dec/10/html-tools/)
Using Claude Code: The Unreasonable Effectiveness of HTML (https://simonwillison.net/2026/May/8/unreasonable-effectiveness-of-html/)
Birchline — Support reply prompt tuner (https://thariqs.github.io/html-effectiveness/20-editor-prompt-tuner.html)
Using Claude Code: The unreasonable effectiveness of HTML | Hacker News (https://news.ycombinator.com/item?id=48071940)
See all this somewhat related piece of mine, in which Claude successfully illustrated in one-shot, after multiple test attempts over the years: “Rabbinic Roots: Unraveling the Family Tree of R’ Ḥiyya and His Nephews (Sanhedrin 5a)” (Apr 18, 2024). Note that in general, tractate Yevamot is (famously) full of complex family relationships; there are existing works that diagram these out.
Bottom line, this personal AI benchmark of mine has been “saturated”.
For another personal benchmark of mine, see my piece on OCR of the medieval Hebrew manuscript Yeriah Gedolah. I continue to test this at regular intervals, and it has not yet been saturated.
See also my many pieces on Talmudic riddles.
גוי.
The traditional explanation for why “non-Jew” is specified throughout these riddles, is as Steinsaltz formulates:
The Talmud is referring to a non-Jew because it does not wish to entertain the idea that a Jew would act in such a manner.
בא על.
For Talmudic Hebrew words for sex, see my “Appendix 3 - Hebrew Verbs for “Sex” “, especially section “The verbs ba’al (בעל) and ba al (בא על) in Mishnaic Hebrew“.
בני אחי - literally: “sons of brothers/siblings”.
There’s no dedicated word in Hebrew for “cousins”. Note also that the word for “brothers” and “siblings” is the same.










