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

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

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

a = A("a")
f = B("f")
c = C("c")
k = B("k")

a.z = c
a.s = f
f.s = k
f.v = c
c.u = k
k.s = f
k.v = c
assert k.v.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
c = C("c")
k = B("k")

a.z = c
a.s = f
f.s = k
f.v = c
c.u = k
k.s = f
k.v = c
assert k.v.u.s.txt == "f"