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

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

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

l = A("l")
d = B("d")
h = C("h")

l.s = d
l.v = h
l.o = h
d.w = l
h.w = d
h.o = l
assert h.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
h = C("h")

l.s = d
l.v = h
l.o = h
d.w = l
h.w = d
h.o = l
assert h.w.w.s.txt == "d"