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

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

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

i.w = g
i.s = g
k.o = e
k.t = i
b.w = k
b.s = g
e.o = k
e.t = l
g.o = k
g.t = a
l.w = k
l.s = g
a.w = e
a.s = k
assert a.s.o.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.txt = txt

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

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

i.w = g
i.s = g
k.o = e
k.t = i
b.w = k
b.s = g
e.o = k
e.t = l
g.o = k
g.t = a
l.w = k
l.s = g
a.w = e
a.s = k
assert a.s.o.o.t.txt == "i"