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

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

n = A("n")
b = B("b")
m = A("m")
l = A("l")
c = A("c")
d = A("d")
j = B("j")
i = A("i")
a = A("a")

n.s = j
b.t = j
b.q = m
m.s = j
l.s = b
c.s = b
d.s = j
j.t = b
j.q = m
i.s = j
a.s = j
assert l.s.q.s.q.s.t.t.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

n = A("n")
b = B("b")
m = A("m")
l = A("l")
c = A("c")
d = A("d")
j = B("j")
i = A("i")
a = A("a")

n.s = j
b.t = j
b.q = m
m.s = j
l.s = b
c.s = b
d.s = j
j.t = b
j.q = m
i.s = j
a.s = j
assert l.s.q.s.q.s.t.t.q.s.txt == "j"