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

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

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

a = A("a")
l = B("l")
m = C("m")

a.v = l
l.v = m
m.x = l
assert a.v.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
m = C("m")

a.v = l
l.v = m
m.x = l
assert a.v.v.x.txt == "l"