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

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

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

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

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

e = A("e")
d = B("d")
l = C("l")
k = D("k")
m = E("m")

e.v = k
d.s = e
d.q = l
d.o = m
l.y = d
l.x = d
l.s = k
k.y = d
k.z = l
k.u = e
m.p = k
assert l.s.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

e = A("e")
d = B("d")
l = C("l")
k = D("k")
m = E("m")

e.v = k
d.s = e
d.q = l
d.o = m
l.y = d
l.x = d
l.s = k
k.y = d
k.z = l
k.u = e
m.p = k
assert l.s.u.v.u.txt == "e"