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

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

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

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

b = A("b")
m = B("m")
i = C("i")
k = D("k")
a = B("a")
d = D("d")
j = B("j")

b.w = d
b.z = k
m.t = i
i.u = d
k.u = d
k.t = b
a.t = i
d.u = k
d.t = b
j.t = i
assert a.t.u.t.w.t.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
i = C("i")
k = D("k")
a = B("a")
d = D("d")
j = B("j")

b.w = d
b.z = k
m.t = i
i.u = d
k.u = d
k.t = b
a.t = i
d.u = k
d.t = b
j.t = i
assert a.t.u.t.w.t.z.u.txt == "d"