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

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

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

j = A("j")
h = B("h")
m = C("m")
b = B("b")

j.u = h
j.z = b
j.s = m
h.s = j
m.v = b
b.s = j
assert b.s.u.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.s: C = None
        self.txt = txt

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

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

j = A("j")
h = B("h")
m = C("m")
b = B("b")

j.u = h
j.z = b
j.s = m
h.s = j
m.v = b
b.s = j
assert b.s.u.s.s.txt == "m"