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

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

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

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

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

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

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

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

m.x = e
m.y = e
m.s = l
n.y = f
h.s = l
i.y = e
l.s = h
e.x = m
e.y = f
e.s = l
c.y = e
f.x = e
f.y = e
f.s = h
b.x = f
b.y = m
b.s = h
assert h.s.s.s.s.s.s.s.s.s.txt == "l"