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

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

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

k = A("k")
m = B("m")
g = C("g")
f = C("f")
e = B("e")
d = C("d")
c = B("c")
l = B("l")
h = B("h")

k.z = f
k.q = d
k.o = c
m.z = h
m.o = c
g.q = h
g.o = l
g.u = k
f.q = h
f.o = h
f.u = k
e.z = m
e.o = h
d.q = c
d.o = l
d.u = k
c.z = l
c.o = h
l.z = e
l.o = c
h.z = m
h.o = c
assert l.z.z.z.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.o: B = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
g = C("g")
f = C("f")
e = B("e")
d = C("d")
c = B("c")
l = B("l")
h = B("h")

k.z = f
k.q = d
k.o = c
m.z = h
m.o = c
g.q = h
g.o = l
g.u = k
f.q = h
f.o = h
f.u = k
e.z = m
e.o = h
d.q = c
d.o = l
d.u = k
c.z = l
c.o = h
l.z = e
l.o = c
h.z = m
h.o = c
assert l.z.z.z.z.z.o.txt == "c"