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

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

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

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

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

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

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

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

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

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

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

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

c.s = j
m.w = k
m.s = c
l.o = k
k.z = c
j.p = m
j.u = k
j.z = c
assert c.s.p.w.z.s.txt == "j"