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: A = None
        self.u: A = None
        self.txt = txt

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

k.o = m
k.v = b
m.x = j
m.u = i
j.o = m
j.v = b
f.x = a
f.u = j
l.o = m
l.v = b
a.o = f
a.v = m
i.o = b
i.v = m
d.o = b
d.v = m
b.x = a
b.u = a
assert b.x.o.x.o.x.v.x.o.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: A = None
        self.u: A = None
        self.txt = txt

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

k.o = m
k.v = b
m.x = j
m.u = i
j.o = m
j.v = b
f.x = a
f.u = j
l.o = m
l.v = b
a.o = f
a.v = m
i.o = b
i.v = m
d.o = b
d.v = m
b.x = a
b.u = a
assert b.x.o.x.o.x.v.x.o.txt == "m"