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

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

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

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

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

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

m.w = i
m.u = b
b.t = g
b.w = e
k.t = g
k.w = l
g.w = i
g.u = b
e.w = h
e.u = i
l.w = b
l.u = k
i.t = e
i.w = m
h.t = e
h.w = e
assert e.w.w.w.w.u.t.w.txt == "h"