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

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

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

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

l.y = k
i.o = l
i.y = k
k.s = l
k.y = l
k.r = i
assert k.y.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

l.y = k
i.o = l
i.y = k
k.s = l
k.y = l
k.r = i
assert k.y.y.r.txt == "i"