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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: B = None
        self.z: E = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: B = None
        self.z: E = None
        self.s: C = None
        self.txt = txt

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

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

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

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

l.p = n
l.t = m
d.o = l
d.r = c
d.z = k
d.s = m
m.q = j
m.r = l
j.z = n
k.p = l
k.t = l
k.v = d
k.w = n
k.x = m
a.o = l
a.r = n
a.z = k
a.s = m
c.o = l
c.r = d
c.z = k
c.s = m
n.o = l
n.r = d
n.z = k
n.s = m
assert c.r.s.r.t.q.txt == "j"