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

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

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

d = A("d")
l = B("l")
g = C("g")
a = C("a")

d.t = l
d.s = l
l.u = a
l.o = d
l.p = g
g.t = l
a.t = l
assert a.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
g = C("g")
a = C("a")

d.t = l
d.s = l
l.u = a
l.o = d
l.p = g
g.t = l
a.t = l
assert a.t.o.t.txt == "l"