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

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

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

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

d = A("d")
f = B("f")
j = C("j")
i = D("i")

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

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

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

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

d = A("d")
f = B("f")
j = C("j")
i = D("i")

d.r = j
d.z = i
d.w = i
d.p = f
f.s = i
j.t = i
i.z = j
i.s = f
i.o = d
i.u = d
assert d.w.u.r.t.txt == "i"