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

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

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

h = A("h")
l = B("l")
a = C("a")
b = B("b")

h.s = l
h.x = a
l.o = b
a.u = h
a.s = h
b.o = l
assert b.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: C = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
a = C("a")
b = B("b")

h.s = l
h.x = a
l.o = b
a.u = h
a.s = h
b.o = l
assert b.o.o.o.txt == "l"