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

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

c = A("c")
e = B("e")
j = A("j")
n = B("n")
f = B("f")
k = B("k")
a = B("a")
l = A("l")
h = A("h")

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

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

c = A("c")
e = B("e")
j = A("j")
n = B("n")
f = B("f")
k = B("k")
a = B("a")
l = A("l")
h = A("h")

c.z = h
e.v = l
e.o = f
j.z = c
n.v = l
n.o = f
f.v = j
f.o = e
k.v = l
k.o = a
a.v = l
a.o = f
l.z = j
h.z = j
assert k.o.v.z.z.z.z.z.txt == "c"