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

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

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

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

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

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

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

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

c.s = i
k.u = i
k.x = i
i.y = c
i.v = c
assert i.y.s.v.txt == "c"