class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

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

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

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

m.q = h
m.w = e
m.s = e
m.p = e
l.u = e
l.p = f
l.y = m
e.v = m
e.u = h
e.w = n
n.z = f
h.z = n
f.z = n
assert l.y.q.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

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

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

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

m.q = h
m.w = e
m.s = e
m.p = e
l.u = e
l.p = f
l.y = m
e.v = m
e.u = h
e.w = n
n.z = f
h.z = n
f.z = n
assert l.y.q.z.z.z.txt == "n"