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

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

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

b.t = m
b.o = l
m.s = l
i.t = m
i.o = m
e.t = m
e.o = d
d.s = m
k.s = m
l.s = m
h.t = m
h.o = m
assert k.s.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.txt = txt

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

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

b.t = m
b.o = l
m.s = l
i.t = m
i.o = m
e.t = m
e.o = d
d.s = m
k.s = m
l.s = m
h.t = m
h.o = m
assert k.s.s.s.s.s.s.s.s.txt == "l"