class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

k.u = l
i.u = m
i.z = d
i.t = l
i.w = c
c.p = m
m.o = k
l.r = m
d.u = m
d.z = i
d.t = l
d.w = c
assert i.z.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

k.u = l
i.u = m
i.z = d
i.t = l
i.w = c
c.p = m
m.o = k
l.r = m
d.u = m
d.z = i
d.t = l
d.w = c
assert i.z.u.o.u.txt == "l"