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

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

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

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

m.v = h
i.r = h
n.u = i
n.y = i
n.t = e
e.v = m
h.v = m
assert e.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

m.v = h
i.r = h
n.u = i
n.y = i
n.t = e
e.v = m
h.v = m
assert e.v.v.v.v.v.txt == "m"