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

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

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

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

i.y = c
i.o = k
c.u = k
k.u = i
assert c.u.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

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

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

i.y = c
i.o = k
c.u = k
k.u = i
assert c.u.u.o.txt == "k"