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

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

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

m = A("m")
e = B("e")
l = C("l")
i = B("i")
a = B("a")
k = B("k")
f = A("f")
j = B("j")

m.v = j
e.r = k
l.y = k
l.z = k
i.r = j
a.r = j
k.r = e
f.v = a
j.r = i
assert i.r.r.r.r.r.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.r: B = None
        self.txt = txt

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

m = A("m")
e = B("e")
l = C("l")
i = B("i")
a = B("a")
k = B("k")
f = A("f")
j = B("j")

m.v = j
e.r = k
l.y = k
l.z = k
i.r = j
a.r = j
k.r = e
f.v = a
j.r = i
assert i.r.r.r.r.r.r.r.txt == "j"