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

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

c = A("c")
m = B("m")
k = A("k")

c.s = k
m.v = c
k.s = c
assert c.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

c = A("c")
m = B("m")
k = A("k")

c.s = k
m.v = c
k.s = c
assert c.s.s.s.txt == "k"