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

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

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

h = A("h")
j = B("j")
k = C("k")
n = C("n")
l = C("l")
b = A("b")
a = C("a")
e = C("e")
i = B("i")
m = A("m")

h.o = a
j.w = l
j.p = k
k.z = b
k.v = h
n.z = b
n.v = m
l.z = b
l.v = m
b.o = k
a.z = h
a.v = m
e.z = m
e.v = m
i.w = e
i.p = e
m.o = k
assert e.v.o.z.o.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
k = C("k")
n = C("n")
l = C("l")
b = A("b")
a = C("a")
e = C("e")
i = B("i")
m = A("m")

h.o = a
j.w = l
j.p = k
k.z = b
k.v = h
n.z = b
n.v = m
l.z = b
l.v = m
b.o = k
a.z = h
a.v = m
e.z = m
e.v = m
i.w = e
i.p = e
m.o = k
assert e.v.o.z.o.v.o.v.txt == "m"