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

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

m = A("m")
h = B("h")
a = A("a")
n = B("n")
j = A("j")
i = B("i")
l = A("l")
e = B("e")
f = A("f")

m.s = l
h.o = n
h.v = i
a.s = j
n.o = h
n.v = e
j.s = l
i.o = n
i.v = n
l.s = f
e.o = n
e.v = h
f.s = l
assert h.v.v.o.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

m = A("m")
h = B("h")
a = A("a")
n = B("n")
j = A("j")
i = B("i")
l = A("l")
e = B("e")
f = A("f")

m.s = l
h.o = n
h.v = i
a.s = j
n.o = h
n.v = e
j.s = l
i.o = n
i.v = n
l.s = f
e.o = n
e.v = h
f.s = l
assert h.v.v.o.v.v.v.txt == "e"