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

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

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

a = A("a")
n = B("n")
d = C("d")
f = B("f")

a.t = d
a.v = d
n.w = f
d.s = n
f.w = n
assert d.s.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
d = C("d")
f = B("f")

a.t = d
a.v = d
n.w = f
d.s = n
f.w = n
assert d.s.w.w.w.txt == "f"