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

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

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

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

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

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

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

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

l.v = m
m.s = i
i.y = l
assert l.v.s.y.txt == "l"