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

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

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

l = A("l")
h = B("h")
e = C("e")
m = B("m")
c = C("c")
k = B("k")
i = B("i")

l.y = i
h.z = l
h.s = i
e.u = h
e.p = h
e.x = c
m.z = l
m.s = k
c.u = h
c.x = e
c.p = m
k.z = l
k.s = m
i.z = l
i.s = k
assert h.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
e = C("e")
m = B("m")
c = C("c")
k = B("k")
i = B("i")

l.y = i
h.z = l
h.s = i
e.u = h
e.p = h
e.x = c
m.z = l
m.s = k
c.u = h
c.x = e
c.p = m
k.z = l
k.s = m
i.z = l
i.s = k
assert h.z.y.z.txt == "l"