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

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

e = A("e")
c = B("c")
m = A("m")
a = B("a")
k = A("k")
i = A("i")
b = A("b")
d = A("d")

e.v = m
c.t = i
m.v = b
a.t = e
k.v = m
i.v = b
b.v = m
d.v = m
assert b.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

e = A("e")
c = B("c")
m = A("m")
a = B("a")
k = A("k")
i = A("i")
b = A("b")
d = A("d")

e.v = m
c.t = i
m.v = b
a.t = e
k.v = m
i.v = b
b.v = m
d.v = m
assert b.v.v.v.v.v.v.v.txt == "m"