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

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

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

n = A("n")
a = B("a")
e = C("e")
g = A("g")
h = A("h")
k = B("k")
m = C("m")
f = A("f")
j = B("j")
c = B("c")

n.o = m
n.z = g
n.q = e
a.z = n
e.w = k
g.o = e
g.z = h
g.q = m
h.o = m
h.z = g
h.q = e
k.z = n
m.w = c
f.o = m
f.q = m
f.z = g
j.z = h
c.z = f
assert j.z.o.w.z.o.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
e = C("e")
g = A("g")
h = A("h")
k = B("k")
m = C("m")
f = A("f")
j = B("j")
c = B("c")

n.o = m
n.z = g
n.q = e
a.z = n
e.w = k
g.o = e
g.z = h
g.q = m
h.o = m
h.z = g
h.q = e
k.z = n
m.w = c
f.o = m
f.q = m
f.z = g
j.z = h
c.z = f
assert j.z.o.w.z.o.w.z.q.txt == "m"