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

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

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

a = A("a")
i = B("i")
k = C("k")
c = A("c")
h = A("h")
b = B("b")
m = C("m")
g = B("g")
n = C("n")
l = B("l")

a.z = n
a.u = m
i.w = k
i.r = k
i.y = b
k.p = c
c.z = k
c.u = n
h.z = k
h.u = m
b.w = m
b.y = i
b.r = n
m.p = h
g.w = m
g.y = l
g.r = k
n.p = c
l.w = n
l.y = g
l.r = k
assert m.p.u.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: C = None
        self.txt = txt

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

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

a = A("a")
i = B("i")
k = C("k")
c = A("c")
h = A("h")
b = B("b")
m = C("m")
g = B("g")
n = C("n")
l = B("l")

a.z = n
a.u = m
i.w = k
i.r = k
i.y = b
k.p = c
c.z = k
c.u = n
h.z = k
h.u = m
b.w = m
b.y = i
b.r = n
m.p = h
g.w = m
g.y = l
g.r = k
n.p = c
l.w = n
l.y = g
l.r = k
assert m.p.u.p.u.p.txt == "h"