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

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

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

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

l.y = j
f.x = l
j.y = m
e.y = i
a.x = l
i.y = e
n.x = l
m.y = i
assert m.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

l.y = j
f.x = l
j.y = m
e.y = i
a.x = l
i.y = e
n.x = l
m.y = i
assert m.y.y.y.y.y.y.txt == "e"