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

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

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

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

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

h.z = e
h.r = e
h.w = e
h.u = e
e.w = m
e.t = n
m.v = h
m.q = e
m.s = e
m.z = e
n.u = h
assert m.v.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.w: B = None
        self.u: B = None
        self.txt = txt

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

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

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

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

h.z = e
h.r = e
h.w = e
h.u = e
e.w = m
e.t = n
m.v = h
m.q = e
m.s = e
m.z = e
n.u = h
assert m.v.z.t.txt == "n"