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

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

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

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

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

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

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

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

n.w = a
g.w = m
h.z = n
h.t = f
h.o = b
b.z = n
b.t = g
b.o = h
k.w = m
j.w = b
m.w = g
f.w = g
a.z = j
a.t = g
a.o = b
assert h.o.z.w.t.w.w.w.txt == "m"