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

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

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

l = A("l")
k = B("k")
n = C("n")
m = A("m")

l.v = m
k.y = m
n.o = m
m.v = l
assert l.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.y: A = None
        self.txt = txt

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

l = A("l")
k = B("k")
n = C("n")
m = A("m")

l.v = m
k.y = m
n.o = m
m.v = l
assert l.v.v.v.v.txt == "l"