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

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

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

m = A("m")
h = B("h")
n = C("n")
e = C("e")

m.v = h
h.z = n
n.r = e
e.r = n
assert h.z.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

m = A("m")
h = B("h")
n = C("n")
e = C("e")

m.v = h
h.z = n
n.r = e
e.r = n
assert h.z.r.r.txt == "n"