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

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

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

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

i = A("i")
d = B("d")
c = C("c")
a = D("a")
b = A("b")
n = C("n")

i.v = a
i.r = d
d.t = c
d.z = a
d.u = a
c.r = a
a.v = b
a.s = n
a.z = d
b.v = a
b.r = d
n.r = a
assert d.t.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
c = C("c")
a = D("a")
b = A("b")
n = C("n")

i.v = a
i.r = d
d.t = c
d.z = a
d.u = a
c.r = a
a.v = b
a.s = n
a.z = d
b.v = a
b.r = d
n.r = a
assert d.t.r.s.r.txt == "a"