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

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

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

n = A("n")
h = B("h")
b = C("b")
m = B("m")
i = C("i")
a = B("a")
g = B("g")
l = A("l")
c = A("c")

n.z = h
h.z = m
b.r = c
b.y = c
b.u = g
m.z = g
i.r = l
i.y = l
i.u = h
a.z = g
g.z = m
l.z = a
c.z = m
assert m.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
b = C("b")
m = B("m")
i = C("i")
a = B("a")
g = B("g")
l = A("l")
c = A("c")

n.z = h
h.z = m
b.r = c
b.y = c
b.u = g
m.z = g
i.r = l
i.y = l
i.u = h
a.z = g
g.z = m
l.z = a
c.z = m
assert m.z.z.z.z.txt == "m"