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

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

k = A("k")
g = B("g")
e = A("e")
a = A("a")
n = A("n")
l = A("l")
b = B("b")
f = A("f")

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

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

k = A("k")
g = B("g")
e = A("e")
a = A("a")
n = A("n")
l = A("l")
b = B("b")
f = A("f")

k.q = g
k.u = g
g.q = e
g.o = k
e.q = g
e.u = g
a.q = g
a.u = b
n.q = g
n.u = b
l.q = g
l.u = g
b.q = e
b.o = f
f.q = g
f.u = g
assert a.u.q.q.o.u.q.u.o.txt == "k"