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

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

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

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

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

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

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

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

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