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

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

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

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

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

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

a.w = k
a.z = k
a.v = l
a.x = l
c.s = d
c.z = l
l.t = a
l.r = a
l.q = c
l.u = c
l.v = d
d.u = a
d.t = a
d.s = l
d.w = k
d.p = c
k.y = d
k.p = c
assert a.w.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: C = None
        self.x: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

a.w = k
a.z = k
a.v = l
a.x = l
c.s = d
c.z = l
l.t = a
l.r = a
l.q = c
l.u = c
l.v = d
d.u = a
d.t = a
d.s = l
d.w = k
d.p = c
k.y = d
k.p = c
assert a.w.p.s.p.txt == "c"