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

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

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

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

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

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

l.t = m
l.u = i
f.z = a
f.s = m
a.z = m
a.u = m
h.t = l
h.x = m
m.r = h
m.t = f
i.t = l
i.x = m
e.t = m
e.u = h
assert h.t.t.t.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

l.t = m
l.u = i
f.z = a
f.s = m
a.z = m
a.u = m
h.t = l
h.x = m
m.r = h
m.t = f
i.t = l
i.x = m
e.t = m
e.u = h
assert h.t.t.t.z.u.txt == "m"