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

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

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

d = A("d")
l = B("l")
e = C("e")
b = B("b")
a = B("a")

d.r = a
l.z = a
l.o = e
e.z = l
b.z = a
b.o = e
a.z = l
a.o = e
assert d.r.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
e = C("e")
b = B("b")
a = B("a")

d.r = a
l.z = a
l.o = e
e.z = l
b.z = a
b.o = e
a.z = l
a.o = e
assert d.r.z.o.z.txt == "l"