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

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

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

d = A("d")
m = B("m")
n = C("n")
e = B("e")
a = A("a")
b = C("b")
l = A("l")
k = B("k")
j = A("j")
f = C("f")

d.y = j
m.y = k
m.w = d
m.o = f
n.z = j
e.y = m
e.w = d
e.o = b
a.y = d
b.z = a
l.y = a
k.y = e
k.w = d
k.o = f
j.y = l
f.z = j
assert f.z.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
n = C("n")
e = B("e")
a = A("a")
b = C("b")
l = A("l")
k = B("k")
j = A("j")
f = C("f")

d.y = j
m.y = k
m.w = d
m.o = f
n.z = j
e.y = m
e.w = d
e.o = b
a.y = d
b.z = a
l.y = a
k.y = e
k.w = d
k.o = f
j.y = l
f.z = j
assert f.z.y.y.y.y.y.y.txt == "a"