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

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

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

b = A("b")
m = B("m")
f = C("f")
l = C("l")
h = A("h")

b.s = f
m.v = b
f.u = b
f.w = m
l.u = h
l.w = m
h.s = l
assert m.v.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
f = C("f")
l = C("l")
h = A("h")

b.s = f
m.v = b
f.u = b
f.w = m
l.u = h
l.w = m
h.s = l
assert m.v.s.u.txt == "b"