class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
f = C("f")
e = D("e")
j = E("j")
c = E("c")

m.x = k
m.z = k
m.p = j
k.x = f
f.v = c
e.u = k
j.r = e
j.u = f
j.p = m
j.y = m
j.t = k
c.r = e
c.u = f
c.p = m
c.y = m
c.t = k
assert m.p.u.v.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
f = C("f")
e = D("e")
j = E("j")
c = E("c")

m.x = k
m.z = k
m.p = j
k.x = f
f.v = c
e.u = k
j.r = e
j.u = f
j.p = m
j.y = m
j.t = k
c.r = e
c.u = f
c.p = m
c.y = m
c.t = k
assert m.p.u.v.r.u.txt == "k"