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

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

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

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

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

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

l.u = i
k.o = e
k.w = l
k.z = l
f.x = i
e.r = k
i.u = l
i.x = l
h.x = i
assert l.u.x.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

l.u = i
k.o = e
k.w = l
k.z = l
f.x = i
e.r = k
i.u = l
i.x = l
h.x = i
assert l.u.x.u.u.u.txt == "i"