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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

l.s = k
h.w = e
k.z = e
f.p = h
e.x = k
e.p = k
e.u = h
e.o = h
e.z = f
m.s = k
assert e.p.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

l.s = k
h.w = e
k.z = e
f.p = h
e.x = k
e.p = k
e.u = h
e.o = h
e.z = f
m.s = k
assert e.p.z.p.z.txt == "e"