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

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

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

d = A("d")
k = B("k")
m = C("m")
l = C("l")

d.x = k
k.z = l
m.x = l
m.t = l
l.x = m
l.t = m
assert k.z.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
m = C("m")
l = C("l")

d.x = k
k.z = l
m.x = l
m.t = l
l.x = m
l.t = m
assert k.z.t.t.txt == "l"