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

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

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

d = A("d")
l = B("l")
c = C("c")

d.t = l
d.r = l
l.y = c
c.q = l
c.s = l
assert d.t.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
c = C("c")

d.t = l
d.r = l
l.y = c
c.q = l
c.s = l
assert d.t.y.q.txt == "l"