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

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

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

n = A("n")
f = B("f")
i = C("i")
e = A("e")
a = A("a")
l = B("l")
c = C("c")
m = B("m")

n.w = e
f.y = c
f.w = m
f.r = n
i.o = n
i.t = c
e.w = n
a.w = e
l.y = i
l.w = m
l.r = a
c.o = n
c.t = i
m.y = i
m.w = f
m.r = e
assert f.w.r.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
i = C("i")
e = A("e")
a = A("a")
l = B("l")
c = C("c")
m = B("m")

n.w = e
f.y = c
f.w = m
f.r = n
i.o = n
i.t = c
e.w = n
a.w = e
l.y = i
l.w = m
l.r = a
c.o = n
c.t = i
m.y = i
m.w = f
m.r = e
assert f.w.r.w.w.txt == "e"