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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: A = None
        self.txt = txt

e = A("e")
d = B("d")
l = A("l")
a = B("a")
m = A("m")
c = B("c")
j = B("j")

e.s = m
d.o = j
d.z = l
l.s = e
a.o = j
a.z = e
m.s = e
c.o = j
c.z = e
j.o = c
j.z = e
assert c.o.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: A = None
        self.txt = txt

e = A("e")
d = B("d")
l = A("l")
a = B("a")
m = A("m")
c = B("c")
j = B("j")

e.s = m
d.o = j
d.z = l
l.s = e
a.o = j
a.z = e
m.s = e
c.o = j
c.z = e
j.o = c
j.z = e
assert c.o.z.s.s.txt == "e"