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

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

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

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

m.o = l
i.w = n
h.w = i
h.x = e
h.q = n
a.w = n
c.w = h
f.w = c
f.x = i
f.q = n
n.w = i
n.x = e
n.q = f
e.w = h
l.o = m
k.o = m
assert m.o.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

m.o = l
i.w = n
h.w = i
h.x = e
h.q = n
a.w = n
c.w = h
f.w = c
f.x = i
f.q = n
n.w = i
n.x = e
n.q = f
e.w = h
l.o = m
k.o = m
assert m.o.o.o.o.o.o.o.o.o.txt == "l"