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

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

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

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

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

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

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

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

c.z = k
m.z = n
m.u = k
g.r = j
g.p = m
g.z = k
i.r = j
i.p = k
i.z = k
a.r = j
a.p = m
a.z = k
j.z = k
n.r = c
n.p = k
n.z = k
k.z = i
k.u = m
assert n.p.u.z.z.u.z.txt == "n"