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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: D = None
        self.z: B = None
        self.u: D = None
        self.t: E = None
        self.txt = txt

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

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

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

m.p = k
m.o = c
k.t = a
c.v = m
c.s = j
c.u = j
c.z = k
c.t = a
j.o = k
j.x = a
a.z = c
a.v = j
assert c.t.v.o.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: D = None
        self.z: B = None
        self.u: D = None
        self.t: E = None
        self.txt = txt

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

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

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

m.p = k
m.o = c
k.t = a
c.v = m
c.s = j
c.u = j
c.z = k
c.t = a
j.o = k
j.x = a
a.z = c
a.v = j
assert c.t.v.o.t.z.txt == "c"