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

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

a = A("a")
i = B("i")
l = B("l")
d = A("d")
m = B("m")
j = B("j")
b = A("b")
e = A("e")
h = B("h")

a.o = j
a.v = l
i.x = m
l.x = h
d.o = j
d.v = l
m.x = l
j.x = l
b.o = j
b.v = i
e.o = m
e.v = l
h.x = m
assert h.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

a = A("a")
i = B("i")
l = B("l")
d = A("d")
m = B("m")
j = B("j")
b = A("b")
e = A("e")
h = B("h")

a.o = j
a.v = l
i.x = m
l.x = h
d.o = j
d.v = l
m.x = l
j.x = l
b.o = j
b.v = i
e.o = m
e.v = l
h.x = m
assert h.x.x.x.x.x.x.txt == "h"