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

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

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

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

n.o = b
j.x = n
b.w = j
assert n.o.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

n.o = b
j.x = n
b.w = j
assert n.o.w.x.txt == "n"