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

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

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

b = A("b")
c = B("c")
j = C("j")

b.s = j
b.x = c
c.t = b
c.v = b
c.o = j
j.w = c
assert c.t.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: B = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
j = C("j")

b.s = j
b.x = c
c.t = b
c.v = b
c.o = j
j.w = c
assert c.t.s.w.txt == "c"