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

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

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

n = A("n")
c = B("c")
k = C("k")
i = A("i")
l = C("l")
d = B("d")
j = A("j")
m = A("m")
g = A("g")
a = B("a")

n.s = d
n.q = c
c.r = k
c.z = k
k.z = l
i.s = a
i.q = a
l.z = k
d.r = k
d.z = l
j.s = c
j.q = a
m.s = c
m.q = c
g.s = d
g.q = c
a.r = k
a.z = l
assert i.q.r.z.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

n = A("n")
c = B("c")
k = C("k")
i = A("i")
l = C("l")
d = B("d")
j = A("j")
m = A("m")
g = A("g")
a = B("a")

n.s = d
n.q = c
c.r = k
c.z = k
k.z = l
i.s = a
i.q = a
l.z = k
d.r = k
d.z = l
j.s = c
j.q = a
m.s = c
m.q = c
g.s = d
g.q = c
a.r = k
a.z = l
assert i.q.r.z.z.z.z.z.z.z.z.txt == "k"