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

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

a = A("a")
e = B("e")
m = B("m")
i = B("i")
h = A("h")
l = A("l")
f = B("f")
c = B("c")

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

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

a = A("a")
e = B("e")
m = B("m")
i = B("i")
h = A("h")
l = A("l")
f = B("f")
c = B("c")

a.s = i
e.z = m
e.v = i
m.z = f
m.v = c
i.z = f
i.v = e
h.s = e
l.s = f
f.z = i
f.v = i
c.z = m
c.v = m
assert a.s.z.z.z.z.z.z.z.txt == "f"