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

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

l = A("l")
f = B("f")
g = B("g")
i = A("i")
k = B("k")
c = A("c")
m = B("m")
n = B("n")
j = A("j")
d = A("d")

l.z = j
f.y = c
f.w = l
g.y = c
g.w = c
i.z = l
k.y = d
k.w = j
c.z = j
m.y = j
m.w = c
n.y = l
n.w = j
j.z = i
d.z = l
assert i.z.z.z.z.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.y: A = None
        self.w: A = None
        self.txt = txt

l = A("l")
f = B("f")
g = B("g")
i = A("i")
k = B("k")
c = A("c")
m = B("m")
n = B("n")
j = A("j")
d = A("d")

l.z = j
f.y = c
f.w = l
g.y = c
g.w = c
i.z = l
k.y = d
k.w = j
c.z = j
m.y = j
m.w = c
n.y = l
n.w = j
j.z = i
d.z = l
assert i.z.z.z.z.z.z.z.z.z.txt == "i"