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

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

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

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

a.u = n
a.s = n
d.o = n
d.r = n
n.t = a
n.p = d
assert n.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.txt = txt

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

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

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

a.u = n
a.s = n
d.o = n
d.r = n
n.t = a
n.p = d
assert n.p.r.p.txt == "d"