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

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

l = A("l")
m = B("m")
n = B("n")
c = B("c")
h = A("h")
j = A("j")
e = A("e")
b = B("b")
a = B("a")

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

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

l = A("l")
m = B("m")
n = B("n")
c = B("c")
h = A("h")
j = A("j")
e = A("e")
b = B("b")
a = B("a")

l.v = e
l.o = n
m.z = j
n.z = l
c.z = e
h.v = l
h.o = c
j.v = h
j.o = n
e.v = j
e.o = m
b.z = j
a.z = j
assert c.z.o.z.v.o.z.v.o.z.txt == "l"