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

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

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

k.v = i
n.z = l
n.s = a
f.z = n
f.s = a
l.z = d
l.s = i
a.z = d
a.s = m
d.z = f
d.s = j
j.z = d
j.s = a
h.v = n
i.z = f
i.s = n
m.z = f
m.s = l
assert f.z.z.z.z.z.s.s.z.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

k.v = i
n.z = l
n.s = a
f.z = n
f.s = a
l.z = d
l.s = i
a.z = d
a.s = m
d.z = f
d.s = j
j.z = d
j.s = a
h.v = n
i.z = f
i.s = n
m.z = f
m.s = l
assert f.z.z.z.z.z.s.s.z.z.s.txt == "a"