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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.txt = txt

k = A("k")
e = B("e")
c = C("c")
l = D("l")
n = E("n")
m = D("m")
g = C("g")

k.z = m
e.r = c
c.v = l
l.p = k
l.z = k
l.s = m
l.q = c
n.t = e
n.y = e
m.p = k
m.z = k
m.s = l
m.q = g
g.v = m
assert e.r.v.p.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.txt = txt

k = A("k")
e = B("e")
c = C("c")
l = D("l")
n = E("n")
m = D("m")
g = C("g")

k.z = m
e.r = c
c.v = l
l.p = k
l.z = k
l.s = m
l.q = c
n.t = e
n.y = e
m.p = k
m.z = k
m.s = l
m.q = g
g.v = m
assert e.r.v.p.z.z.txt == "k"