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

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

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

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

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

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

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

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

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

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

m.v = b
m.w = b
m.u = l
f.t = b
f.v = b
f.z = l
f.o = m
l.v = b
b.z = m
assert f.t.z.u.v.txt == "b"