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

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

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

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

n.t = k
n.u = k
k.w = f
f.w = k
assert f.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.txt = txt

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

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

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

n.t = k
n.u = k
k.w = f
f.w = k
assert f.w.w.w.txt == "k"