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

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

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

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

d = A("d")
e = B("e")
f = C("f")
n = D("n")
i = C("i")
h = C("h")
m = C("m")

d.u = n
e.z = f
f.t = e
f.y = d
f.v = d
n.z = h
i.t = e
i.y = d
i.v = d
h.t = e
h.y = d
h.v = d
m.t = e
m.y = d
m.v = d
assert h.t.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
f = C("f")
n = D("n")
i = C("i")
h = C("h")
m = C("m")

d.u = n
e.z = f
f.t = e
f.y = d
f.v = d
n.z = h
i.t = e
i.y = d
i.v = d
h.t = e
h.y = d
h.v = d
m.t = e
m.y = d
m.v = d
assert h.t.z.v.u.txt == "n"