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.s: B = None
        self.u: A = None
        self.txt = txt

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

j.q = a
j.u = f
a.s = b
a.u = n
d.q = l
d.u = a
f.s = l
f.u = d
e.q = b
e.u = b
n.q = b
n.u = b
k.q = a
k.u = b
l.s = a
l.u = n
b.s = a
b.u = k
assert j.q.s.u.u.s.s.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.s: B = None
        self.u: A = None
        self.txt = txt

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

j.q = a
j.u = f
a.s = b
a.u = n
d.q = l
d.u = a
f.s = l
f.u = d
e.q = b
e.u = b
n.q = b
n.u = b
k.q = a
k.u = b
l.s = a
l.u = n
b.s = a
b.u = k
assert j.q.s.u.u.s.s.txt == "b"