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

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

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

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

a = A("a")
d = B("d")
e = C("e")
k = D("k")

a.x = k
a.w = d
a.u = e
d.y = a
d.o = k
d.u = e
e.z = a
k.s = e
k.u = e
assert d.y.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
e = C("e")
k = D("k")

a.x = k
a.w = d
a.u = e
d.y = a
d.o = k
d.u = e
e.z = a
k.s = e
k.u = e
assert d.y.w.u.txt == "e"