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

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

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

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

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

k = A("k")
m = B("m")
e = C("e")
d = D("d")
i = E("i")
f = D("f")
j = B("j")
a = C("a")

k.t = j
k.v = e
k.p = i
m.v = i
m.s = e
e.p = j
e.w = a
d.v = a
i.z = e
f.v = a
j.v = i
j.s = e
a.p = j
a.w = e
assert i.z.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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

k = A("k")
m = B("m")
e = C("e")
d = D("d")
i = E("i")
f = D("f")
j = B("j")
a = C("a")

k.t = j
k.v = e
k.p = i
m.v = i
m.s = e
e.p = j
e.w = a
d.v = a
i.z = e
f.v = a
j.v = i
j.s = e
a.p = j
a.w = e
assert i.z.w.w.w.w.txt == "e"