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

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

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

f = A("f")
l = B("l")
n = C("n")
b = C("b")
k = B("k")
m = B("m")
e = C("e")
i = B("i")

f.p = k
f.w = k
f.v = l
l.o = b
l.s = b
n.w = m
b.w = l
k.o = e
k.s = n
m.o = b
m.s = b
e.w = i
i.o = n
i.s = e
assert m.s.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.w: B = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
n = C("n")
b = C("b")
k = B("k")
m = B("m")
e = C("e")
i = B("i")

f.p = k
f.w = k
f.v = l
l.o = b
l.s = b
n.w = m
b.w = l
k.o = e
k.s = n
m.o = b
m.s = b
e.w = i
i.o = n
i.s = e
assert m.s.w.o.w.txt == "l"