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

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

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

n = A("n")
d = B("d")
f = C("f")
c = B("c")
a = B("a")
l = B("l")
j = C("j")

n.r = c
d.u = a
f.z = c
c.u = l
a.u = d
l.u = c
j.z = c
assert d.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
f = C("f")
c = B("c")
a = B("a")
l = B("l")
j = C("j")

n.r = c
d.u = a
f.z = c
c.u = l
a.u = d
l.u = c
j.z = c
assert d.u.u.u.u.u.u.u.txt == "a"