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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

l = A("l")
k = B("k")
a = C("a")
b = B("b")
c = B("c")
j = C("j")
m = A("m")
e = C("e")
h = A("h")
i = B("i")

l.w = m
l.z = b
k.z = a
a.y = j
b.z = j
c.z = a
j.y = e
m.w = l
m.z = k
e.y = j
h.w = l
h.z = k
i.z = a
assert b.z.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

l = A("l")
k = B("k")
a = C("a")
b = B("b")
c = B("c")
j = C("j")
m = A("m")
e = C("e")
h = A("h")
i = B("i")

l.w = m
l.z = b
k.z = a
a.y = j
b.z = j
c.z = a
j.y = e
m.w = l
m.z = k
e.y = j
h.w = l
h.z = k
i.z = a
assert b.z.y.y.y.y.y.y.y.txt == "e"