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

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

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

a = A("a")
d = B("d")
b = C("b")
e = C("e")

a.t = d
a.s = b
d.v = a
b.u = d
e.u = d
assert a.s.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
b = C("b")
e = C("e")

a.t = d
a.s = b
d.v = a
b.u = d
e.u = d
assert a.s.u.v.txt == "a"