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

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

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

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

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

l = A("l")
a = B("a")
e = C("e")
k = D("k")
c = E("c")

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

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

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

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

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

l = A("l")
a = B("a")
e = C("e")
k = D("k")
c = E("c")

l.u = a
a.u = l
e.u = a
e.y = a
e.t = k
k.r = e
k.u = l
k.o = l
k.t = a
c.u = e
assert l.u.u.u.txt == "a"