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

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

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

i = A("i")
d = B("d")
n = C("n")
j = C("j")

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

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

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

i = A("i")
d = B("d")
n = C("n")
j = C("j")

i.u = j
d.r = n
d.t = n
n.p = j
j.p = n
assert n.p.p.p.p.txt == "n"