class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.w: C = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

l.v = m
l.z = d
l.w = b
l.u = f
i.v = m
b.v = d
b.s = l
f.t = m
f.s = m
f.r = m
f.w = m
d.v = i
d.z = l
d.w = b
d.u = f
m.v = i
assert d.u.s.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.w: C = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

l.v = m
l.z = d
l.w = b
l.u = f
i.v = m
b.v = d
b.s = l
f.t = m
f.s = m
f.r = m
f.w = m
d.v = i
d.z = l
d.w = b
d.u = f
m.v = i
assert d.u.s.v.v.txt == "m"