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

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

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

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

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

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

e.q = c
l.u = i
l.o = c
k.u = i
k.o = g
n.q = k
c.u = n
c.o = l
g.u = n
g.o = d
i.q = c
d.u = n
d.o = g
assert k.o.u.q.o.o.u.q.o.txt == "g"