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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.s: D = None
        self.y: A = 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.r: C = None
        self.o: A = None
        self.txt = txt

a = A("a")
l = B("l")
i = C("i")
e = D("e")
g = E("g")

a.u = l
l.s = a
l.r = e
l.z = i
l.o = i
i.z = a
i.t = a
i.y = a
i.s = e
e.z = a
g.r = i
g.o = a
assert g.o.u.s.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.s: D = None
        self.y: A = 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.r: C = None
        self.o: A = None
        self.txt = txt

a = A("a")
l = B("l")
i = C("i")
e = D("e")
g = E("g")

a.u = l
l.s = a
l.r = e
l.z = i
l.o = i
i.z = a
i.t = a
i.y = a
i.s = e
e.z = a
g.r = i
g.o = a
assert g.o.u.s.u.r.txt == "e"