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

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

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

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

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

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

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

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

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

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

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