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

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

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

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

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

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

g.s = c
g.u = c
m.p = g
m.w = g
i.p = c
i.w = g
l.p = c
l.w = c
f.p = g
f.w = g
c.s = g
c.u = g
n.p = g
n.w = g
k.p = c
k.w = c
a.p = c
a.w = g
assert f.w.s.u.s.s.u.u.u.txt == "c"