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

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

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

i = A("i")
d = B("d")
a = C("a")

i.s = d
d.t = a
a.y = d
assert d.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
a = C("a")

i.s = d
d.t = a
a.y = d
assert d.t.y.t.txt == "a"