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

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

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

b = A("b")
k = B("k")
m = C("m")

b.x = k
b.t = k
k.o = b
m.u = k
m.s = b
assert k.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: B = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
m = C("m")

b.x = k
b.t = k
k.o = b
m.u = k
m.s = b
assert k.o.t.o.txt == "b"