class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: B = None
        self.txt = txt

e = A("e")
d = B("d")
j = A("j")
g = B("g")
l = A("l")
i = A("i")
m = A("m")

e.s = g
e.p = d
d.t = i
d.p = g
j.s = d
j.p = d
g.t = l
g.p = d
l.s = g
l.p = g
i.s = d
i.p = g
m.s = g
m.p = g
assert d.t.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: B = None
        self.txt = txt

e = A("e")
d = B("d")
j = A("j")
g = B("g")
l = A("l")
i = A("i")
m = A("m")

e.s = g
e.p = d
d.t = i
d.p = g
j.s = d
j.p = d
g.t = l
g.p = d
l.s = g
l.p = g
i.s = d
i.p = g
m.s = g
m.p = g
assert d.t.p.p.txt == "d"