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

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

k = A("k")
j = B("j")
e = B("e")
l = B("l")
f = B("f")
a = A("a")
d = B("d")
h = A("h")
g = B("g")
c = B("c")

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

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

k = A("k")
j = B("j")
e = B("e")
l = B("l")
f = B("f")
a = A("a")
d = B("d")
h = A("h")
g = B("g")
c = B("c")

k.y = c
j.w = a
j.z = d
e.w = a
e.z = c
l.w = a
l.z = e
f.w = a
f.z = l
a.y = e
d.w = h
d.z = e
h.y = g
g.w = k
g.z = e
c.w = h
c.z = j
assert c.z.w.y.txt == "e"