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

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

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

i = A("i")
f = B("f")
j = C("j")

i.u = j
i.o = f
f.s = j
f.w = i
j.x = f
assert j.x.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: B = None
        self.txt = txt

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

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

i = A("i")
f = B("f")
j = C("j")

i.u = j
i.o = f
f.s = j
f.w = i
j.x = f
assert j.x.w.o.txt == "f"