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

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

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

n = A("n")
g = B("g")
e = C("e")
i = A("i")
j = C("j")
b = A("b")
l = B("l")
d = A("d")
a = C("a")
k = B("k")

n.q = d
n.u = g
g.o = l
g.x = l
e.s = k
i.q = n
i.u = l
j.s = l
b.q = d
b.u = g
l.o = g
l.x = g
d.q = n
d.u = k
a.s = k
k.o = l
k.x = l
assert a.s.o.o.x.o.x.o.x.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
e = C("e")
i = A("i")
j = C("j")
b = A("b")
l = B("l")
d = A("d")
a = C("a")
k = B("k")

n.q = d
n.u = g
g.o = l
g.x = l
e.s = k
i.q = n
i.u = l
j.s = l
b.q = d
b.u = g
l.o = g
l.x = g
d.q = n
d.u = k
a.s = k
k.o = l
k.x = l
assert a.s.o.o.x.o.x.o.x.x.o.txt == "l"