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

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

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

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

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

d = A("d")
b = B("b")
i = C("i")
f = D("f")
l = E("l")
c = B("c")
n = C("n")
h = E("h")
m = C("m")
k = B("k")

d.o = f
d.u = f
b.v = f
b.p = i
i.p = k
f.z = m
l.z = n
c.v = f
c.p = m
n.p = c
h.z = i
m.p = k
k.v = f
k.p = m
assert f.z.p.p.p.v.z.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
i = C("i")
f = D("f")
l = E("l")
c = B("c")
n = C("n")
h = E("h")
m = C("m")
k = B("k")

d.o = f
d.u = f
b.v = f
b.p = i
i.p = k
f.z = m
l.z = n
c.v = f
c.p = m
n.p = c
h.z = i
m.p = k
k.v = f
k.p = m
assert f.z.p.p.p.v.z.p.p.p.txt == "k"