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

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

b = A("b")
n = B("n")
e = B("e")
c = B("c")
l = B("l")
m = B("m")
j = B("j")
i = B("i")
f = A("f")
d = A("d")

b.w = f
n.y = m
n.w = m
e.y = m
e.w = n
c.y = e
c.w = e
l.y = e
l.w = c
m.y = n
m.w = n
j.y = m
j.w = c
i.y = c
i.w = l
f.w = b
d.w = f
assert f.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

b = A("b")
n = B("n")
e = B("e")
c = B("c")
l = B("l")
m = B("m")
j = B("j")
i = B("i")
f = A("f")
d = A("d")

b.w = f
n.y = m
n.w = m
e.y = m
e.w = n
c.y = e
c.w = e
l.y = e
l.w = c
m.y = n
m.w = n
j.y = m
j.w = c
i.y = c
i.w = l
f.w = b
d.w = f
assert f.w.w.w.w.w.txt == "b"