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

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

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

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

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

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

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

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

l.o = i
f.s = l
i.y = e
m.y = f
b.y = e
n.o = i
e.s = n
k.s = l
assert i.y.s.o.y.s.o.y.s.txt == "n"