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

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

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

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

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

m.r = k
n.v = j
n.o = g
f.p = e
f.u = e
g.z = n
h.p = e
h.u = g
k.p = e
k.u = g
l.p = g
l.u = g
j.v = n
j.o = g
e.z = j
assert k.u.z.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

m.r = k
n.v = j
n.o = g
f.p = e
f.u = e
g.z = n
h.p = e
h.u = g
k.p = e
k.u = g
l.p = g
l.u = g
j.v = n
j.o = g
e.z = j
assert k.u.z.o.z.o.z.txt == "n"