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

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

k = A("k")
m = B("m")
j = A("j")
n = A("n")
b = A("b")
d = B("d")
a = B("a")
i = A("i")
l = B("l")

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

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

k = A("k")
m = B("m")
j = A("j")
n = A("n")
b = A("b")
d = B("d")
a = B("a")
i = A("i")
l = B("l")

k.w = m
m.o = i
m.v = k
j.w = m
n.w = m
b.w = l
d.o = j
d.v = j
a.o = k
a.v = j
i.w = l
l.o = n
l.v = j
assert l.v.w.o.w.o.w.v.w.v.txt == "k"