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

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

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

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

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

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

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

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

n.o = k
n.x = e
d.u = c
d.s = l
f.p = d
c.o = n
c.x = l
m.p = g
k.o = c
k.x = e
g.u = c
g.s = l
i.p = e
l.u = c
l.s = e
e.u = n
e.s = g
assert e.s.s.u.x.txt == "l"