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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

f = A("f")
b = B("b")
m = C("m")
c = D("c")
l = C("l")

f.z = l
f.t = l
f.r = l
f.v = b
b.u = f
m.y = b
c.y = l
l.y = b
assert m.y.u.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: B = None
        self.t: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

f = A("f")
b = B("b")
m = C("m")
c = D("c")
l = C("l")

f.z = l
f.t = l
f.r = l
f.v = b
b.u = f
m.y = b
c.y = l
l.y = b
assert m.y.u.t.y.txt == "b"