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

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

f = A("f")
d = B("d")
c = A("c")
a = A("a")
l = B("l")
n = B("n")
m = A("m")
i = A("i")

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

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

f = A("f")
d = B("d")
c = A("c")
a = A("a")
l = B("l")
n = B("n")
m = A("m")
i = A("i")

f.s = a
f.y = c
d.w = l
d.u = n
c.s = f
c.y = a
a.s = i
a.y = c
l.w = n
l.u = d
n.w = l
n.u = d
m.s = i
m.y = f
i.s = a
i.y = c
assert l.w.w.u.w.u.w.txt == "l"