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

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

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

m = A("m")
l = B("l")
d = C("d")
e = A("e")
k = B("k")
a = C("a")

m.y = d
l.y = k
d.v = k
e.y = a
k.y = l
a.v = k
assert m.y.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
d = C("d")
e = A("e")
k = B("k")
a = C("a")

m.y = d
l.y = k
d.v = k
e.y = a
k.y = l
a.v = k
assert m.y.v.y.y.txt == "k"