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

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

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

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

e.u = d
e.t = k
e.o = n
g.p = n
i.p = g
i.q = b
n.p = k
m.u = f
m.t = g
m.o = k
b.p = g
b.q = i
l.u = e
l.t = k
l.o = k
k.p = g
d.u = f
d.t = g
d.o = g
f.u = l
f.t = n
f.o = g
assert b.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.o: B = None
        self.txt = txt

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

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

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

e.u = d
e.t = k
e.o = n
g.p = n
i.p = g
i.q = b
n.p = k
m.u = f
m.t = g
m.o = k
b.p = g
b.q = i
l.u = e
l.t = k
l.o = k
k.p = g
d.u = f
d.t = g
d.o = g
f.u = l
f.t = n
f.o = g
assert b.p.p.p.p.p.txt == "n"