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

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

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

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

n.s = e
n.z = d
n.q = a
a.p = c
a.s = d
d.r = j
d.u = c
c.p = a
c.s = e
j.r = d
j.u = a
e.r = d
e.u = a
assert c.s.u.p.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

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

n.s = e
n.z = d
n.q = a
a.p = c
a.s = d
d.r = j
d.u = c
c.p = a
c.s = e
j.r = d
j.u = a
e.r = d
e.u = a
assert c.s.u.p.s.u.s.txt == "d"