class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

j = A("j")
c = B("c")
d = C("d")
k = D("k")
i = E("i")
n = E("n")

j.s = c
c.s = d
d.z = c
d.v = k
d.w = j
k.z = i
k.s = j
k.q = c
k.w = n
k.p = d
i.o = k
n.o = k
assert d.z.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

j = A("j")
c = B("c")
d = C("d")
k = D("k")
i = E("i")
n = E("n")

j.s = c
c.s = d
d.z = c
d.v = k
d.w = j
k.z = i
k.s = j
k.q = c
k.w = n
k.p = d
i.o = k
n.o = k
assert d.z.s.z.s.txt == "d"