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

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

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

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

h = A("h")
d = B("d")
m = C("m")
f = D("f")
k = B("k")

h.v = f
h.y = f
h.r = f
d.w = m
d.t = h
d.x = k
d.z = f
m.u = d
m.r = f
m.q = h
f.z = d
f.s = d
f.v = d
f.x = h
k.w = m
k.t = h
k.x = d
k.z = f
assert k.w.u.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: D = None
        self.r: D = None
        self.txt = txt

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

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

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

h = A("h")
d = B("d")
m = C("m")
f = D("f")
k = B("k")

h.v = f
h.y = f
h.r = f
d.w = m
d.t = h
d.x = k
d.z = f
m.u = d
m.r = f
m.q = h
f.z = d
f.s = d
f.v = d
f.x = h
k.w = m
k.t = h
k.x = d
k.z = f
assert k.w.u.x.t.txt == "h"