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

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

l = A("l")
g = B("g")
b = B("b")
j = B("j")
k = A("k")
c = B("c")
m = B("m")
a = A("a")

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

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

l = A("l")
g = B("g")
b = B("b")
j = B("j")
k = A("k")
c = B("c")
m = B("m")
a = A("a")

l.w = m
l.o = k
g.q = b
g.t = a
b.q = c
b.t = k
j.q = m
j.t = k
k.w = j
k.o = l
c.q = j
c.t = a
m.q = g
m.t = a
a.w = b
a.o = l
assert a.o.w.t.w.txt == "b"