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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.o: B = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

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

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

l.s = e
g.q = k
f.s = l
f.z = l
f.r = e
f.o = g
f.t = k
e.x = l
k.u = f
k.q = f
k.p = f
k.o = g
k.x = l
assert f.s.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.o: B = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

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

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

l.s = e
g.q = k
f.s = l
f.z = l
f.r = e
f.o = g
f.t = k
e.x = l
k.u = f
k.q = f
k.p = f
k.o = g
k.x = l
assert f.s.s.x.s.txt == "e"