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

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

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

f = A("f")
n = B("n")
i = C("i")
e = A("e")
k = B("k")
d = C("d")
a = A("a")
m = C("m")

f.w = k
f.o = m
f.z = m
n.x = k
n.p = e
n.w = i
i.w = a
e.w = k
e.o = i
e.z = m
k.x = n
k.p = e
k.w = d
d.w = e
a.w = k
a.o = d
a.z = d
m.w = e
assert f.w.p.z.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: C = None
        self.z: C = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
i = C("i")
e = A("e")
k = B("k")
d = C("d")
a = A("a")
m = C("m")

f.w = k
f.o = m
f.z = m
n.x = k
n.p = e
n.w = i
i.w = a
e.w = k
e.o = i
e.z = m
k.x = n
k.p = e
k.w = d
d.w = e
a.w = k
a.o = d
a.z = d
m.w = e
assert f.w.p.z.w.w.w.w.txt == "e"