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

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

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

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

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

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

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

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

b.w = j
b.o = j
b.u = c
j.y = b
j.x = b
j.r = b
c.y = b
assert j.x.u.y.txt == "b"