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

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

e = A("e")
f = B("f")
g = A("g")
l = B("l")
k = A("k")
b = B("b")
h = B("h")
d = B("d")
i = B("i")
c = B("c")

e.s = k
f.z = k
f.w = k
g.s = e
l.z = e
l.w = k
k.s = e
b.z = g
b.w = g
h.z = k
h.w = e
d.z = k
d.w = g
i.z = g
i.w = e
c.z = e
c.w = e
assert k.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

e = A("e")
f = B("f")
g = A("g")
l = B("l")
k = A("k")
b = B("b")
h = B("h")
d = B("d")
i = B("i")
c = B("c")

e.s = k
f.z = k
f.w = k
g.s = e
l.z = e
l.w = k
k.s = e
b.z = g
b.w = g
h.z = k
h.w = e
d.z = k
d.w = g
i.z = g
i.w = e
c.z = e
c.w = e
assert k.s.s.s.txt == "e"