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

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

k = A("k")
n = B("n")
i = A("i")
b = B("b")
c = B("c")
a = B("a")
d = A("d")
j = A("j")
g = A("g")

k.y = j
k.z = g
n.y = j
n.w = c
i.y = j
i.z = j
b.y = d
b.w = n
c.y = i
c.w = a
a.y = i
a.w = c
d.y = k
d.z = i
j.y = i
j.z = g
g.y = j
g.z = j
assert a.w.y.z.z.z.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: A = None
        self.txt = txt

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

k = A("k")
n = B("n")
i = A("i")
b = B("b")
c = B("c")
a = B("a")
d = A("d")
j = A("j")
g = A("g")

k.y = j
k.z = g
n.y = j
n.w = c
i.y = j
i.z = j
b.y = d
b.w = n
c.y = i
c.w = a
a.y = i
a.w = c
d.y = k
d.z = i
j.y = i
j.z = g
g.y = j
g.z = j
assert a.w.y.z.z.z.y.z.y.txt == "i"