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

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

c = A("c")
l = B("l")
n = B("n")
g = A("g")
e = B("e")
a = A("a")
m = A("m")
i = B("i")
k = B("k")
j = B("j")

c.q = k
l.w = a
n.w = c
g.q = l
e.w = m
a.q = l
m.q = n
i.w = c
k.w = m
j.w = c
assert l.w.q.w.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

c = A("c")
l = B("l")
n = B("n")
g = A("g")
e = B("e")
a = A("a")
m = A("m")
i = B("i")
k = B("k")
j = B("j")

c.q = k
l.w = a
n.w = c
g.q = l
e.w = m
a.q = l
m.q = n
i.w = c
k.w = m
j.w = c
assert l.w.q.w.q.w.q.txt == "l"