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

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

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

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

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

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

a.w = l
a.y = h
l.w = k
l.s = n
h.w = n
h.y = j
n.w = c
n.s = l
e.w = n
e.y = j
m.w = l
m.y = a
j.w = k
j.y = i
k.w = c
k.s = l
c.w = k
c.s = k
i.w = k
i.y = j
assert k.s.s.s.w.w.s.s.w.s.s.txt == "n"